posted by bmishkin  11/10/2008

Running rails applications with Apache has never been great. In the past, options have been (from best to worst):

Now there is a new player on the scene, Phusion Passenger. I haven’t used it yet in for a high traffic site, but for a tiny project it worked like a charm with no hiccups. Just do: (these steps are for Apache 2.0.52)

sudo gem install passenger
passenger-install-apache2-module
Follow the instructions and create /etc/apache2/conf.d/passenger:
1
2
3
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.0.3
PassengerRuby /usr/local/bin/ruby
Then just point apache at your public folder:
1
2
3
4
<VirtualHost www.foobar.com:80>
    ServerName www.foobar.com
    DocumentRoot /webapps/foobar/public
</VirtualHost>
Restart apache, and that’s it. Then do
touch /webapps/foobar/tmp/restart.txt

to reload rails whenever you update your code. Brilliant!

See mod_rails for more info or the docs. Thanks, Phusion!

Leave a Comment