Picking a production configurationIt is nice for Rails to have easy-to-use application servers such as Mongrel or Webrick. For a low traffic site like mine, it should be okay in terms of performance. However, I have existing python CGIs and contents may not run. I need to create a hybrid envornment to serve both legacy CGIs and new Rails apps. There are a bunch of possibilities, and I picked apache + Phusion Passenger because 1) the existing site runs apache and 2) it seems to be one of the good choices in 2008-2009.
Phusion Passenger installation on Gentoo LinuxInstallation of Phusion Passenger was simple, but apache configuration was not. This is not Passenger's fault by the way. Passenger is an Apache loadable module. Apache needs to load it when it starts. Gentoo Linux stores module configurations in
/etc/modules.d!). I created
/etc/apache2/99_passenger_gaku_net.confI had a couple of erros here and here's how I debugged.
- I had wrong PassengerRuby path. Passenger didn't spit error. Just type the Ruby path and make sure it runs a Ruby interpretor.
- Use PassengerLogLevel directive for debugging. PassengerLogLevel 1
- I enabled Apache's /server-info handler by opening it up to everyone temporalily. To do this, modify /etc/apache2/modules.d/00_mod_info.conf. Then, http://www.gaku.net/server-info shows useful info on Apache, and it should have mod_passenger.c in the page when the module was properly loaded. (/server-info is turned off now).
Installing a Rails appAs I have existing content on my site, I decided to give
/isbnto my test Rails app. Other URI will be served by existing configuration. It can be achieved by adding a following line in my vhost configution in
RailsBaseURI /isbnThe filesystem directory
/web/isbnneeds to point the Rails app's public directory. I created a symboic link from my web directory. My error here was using a wrong directive. There is
RukeBaseURI. I needed to use