I just noticed today that I was consistently getting 500 internal server errors on my site which is using Apache 2.2.3, Mongrel 0.3.18 and the mod_proxy and proxy_balancer modules for apache.

After looking into the apache error log I saw this:

proxy: error reading status line from remote server ...

After doing some googleing I found this article.

It states that the following lines need to be placed in your apache conf to fix a current bug in mod_proxy:

#Fix for Apache bug 39499
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1

The change has been submited to my conf, I will post the results.

Advertisements

Rotating Ruby on Rails Logger

December 10, 2006

This is a very simple process. Just add a line in your config/environment.rb right BEFORE Rails::Initializer.run do |config|.

The line looks like this:

RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", "daily")

You can find other parameters to pass to it by looking at the ruby Logger API.

We just flipped the switch. Free and easy copyright registration is available for the ever growing digital universe at http://www.MyFreeCopyright.com

I must now go and consume this bubbly.

I had the problem of two div floats and having the text below clear them in all browsers. After finding this article: http://positioniseverything.net/easyclearing.html my quick solution was this:

<div>

<div style=”float:left;”></div>

<div style=”float:right;”></div>

<br style=”clear:both”/>

</div>

The key here is that the float elements are contained in their own DIV and a BR tag is used to clear the floats. Those two tricks allow this to work in all browsers.

There may be a better way, but for now every time I run migrate on a production server I need to set the ENV variable:

export RAILS_ENV=production
rake migrate

After doing some research and playing around, the easiest and best approach for an svn server, in my opinion, is svnserve:

http://svnbook.red-bean.com/en/1.0/ch06s03.html

It is quick and easy to setup and that is what I am all about. It allows access to multiple svn repositories and has an easy authentication setup. Once it is installed and your repository is created:

# svnadmin create ~user/source/project1

You can run svnserve one directory up and it will serve all repositories below it.

To configure authentication you modify two files: passwd and svnserve.conf, both in the /conf directory in the created repository. NOTE – when you modify these files the first entry has to have only one space from the begining of the line to the argument.

To start the server you just type:

# svnserve -d -r ~user/source

That is it. Time to move on to the next task.

Last night I was building out my third server with the help of a linux guru. I just wanted to record useful commands I did while setting up all the components. Note this is on a debian server and may be different for other linux flavors.

Find a process:

# ps aux | grep 

Show all listening processes:

# netstat -apt 

Find what applications are installed on debian:

# dpkg -l 
# dpkg -l | grep 

Migrate a MySQL db:
Export

# mysqldump -u user -p dbase_name > db.dump 

Import

# mysql -u user -p dbase_name < db.dump

Set Apache2 permissions for site directories:
Apache runs under the group www-data. You need to make sure that your sites directory and files can be read by apache.

# chmod 770 ~user/www
# chgrp -R www-data ~user/www

Test Apache2 configuration to recieve more output if it is wrong:

# apache2ctl --configtest