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

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

I just got a clean VPS with debian installed and am setting it up to run my Ruby on Rails application. The setup is bare bones and only includes these base applications: Ruby, Rails, Mysql 5, Apache 2.2.3 (with mod_proxy_balancer) and Mongrel.

1. Base Debian setup
I just followed these excellent directions:

http://brainspl.at/rails_stack.html

I replaced some outdate packages for some of the newer ones. Mysql 5 and dependiences being the biggest ones.

2. Mongrel setup
I just followed these excellent directions:

http://blog.codahale.com/

3. Apache 2.2.3 setup

As of the creation of this article Debian has Apache 2.2.3 built in the unstable tree. Grab this! It will make upgrading and bug fixes much easier.

To enable all the modules we need for mongrel – rails setup do this from /etc/apache2/mods-enabled:


# ln -s ../mods-available/rewrite.load .
# ln -s ../mods-available/ssl.load .
# ln -s ../mods-available/deflate.load .
# ln -s ../mods-available/headers.load .
# ln -s ../mods-available/proxy.load .
# ln -s ../mods-available/proxy_http.load .
# ln -s ../mods-available/proxy_balancer.load .

Now restart Apache and it should be all ready to go.

4. SVN setup

I folowed this article to set up the Ruby on Rails project in SVN:

http://maniacalrage.net/past/2006/4/12/heres_how_i_create_a/

and this one to set up WebDAV and group access to the SVN:

http://www.howtoforge.com/debian_subversion_websvn

That should be it for the inital setup. Go create and launch your application!