Host Ruby on Rails Tracks on Apache2

apache-2.2phusion-passengerruby-on-rails

I'm having problems getting Tracks to be hosted via Apache2 on Ubuntu 10.04. I've followed several tutorials, but none work. I've got the Tracks git repo in /var/lib/tracks and a symbolic link to /var/lib/tracks/public in /var/www.I've installed passenger and enabled the libapache2-mod-passenger. I've configured a VirtualHost but I get a broken link page (not sure if it is 404) when I go to http: //localhost/tracks. I've temporarily disabled the default VirtualHost for troubleshooting, but when I go to http: //localhost in Firefox I get the list of files in /var/lib/tracks/public, but in Chromium I get the default "It works!" index.html page.

/etc/apache/mods-enabled/passenger.load

LoadModule passenger_module /usr/lib/apache2/modules/mod_passenger.so

/etc/apache/mods-enabled/passenger.conf

<IfModule mod_passenger.c>
  PassengerRoot /home/erich/.gem/ruby/1.8/gems/passenger-3.0.2
  PassengerRuby /usr/bin/ruby1.8
</IfModule>

/etc/apache/sites-enabled/tracks

<VirtualHost *:80>
    ServerName tracks.localhost
    ServerAdmin webmaster@localhost

    DocumentRoot /var/lib/tracks/public
    <Directory /var/lib/tracks/public>
            AllowOverride all
            Options -MultiViews
    </Directory>

    RailsBaseURI /tracks
    #<Directory /var/lib/tracks>
            #Options -MultiViews
    #</Directory>

</VirtualHost>

In the error.log the following message:

[Sun Feb 06 08:33:51 2011] [error] [client 192.168.1.100] File does not exist: /var/lib/tracks/public/tracks
[Sun Feb 06 08:48:30 2011] [notice] caught SIGTERM, shutting down
[Sun Feb 06 08:48:31 2011] [error] *** Passenger could not be initialized because of this error: The Passenger spawn server script, '/home/erich/.gem/ruby/1.8/gems/passenger-3.0.2/lib/phusion_passenger/passenger-spawn-server', does not exist. Please check whether the 'PassengerRoot' option is specified correctly.
[Sun Feb 06 08:48:31 2011] [error] *** Passenger could not be initialized because of this error: The Passenger spawn server script, '/home/erich/.gem/ruby/1.8/gems/passenger-3.0.2/lib/phusion_passenger/passenger-spawn-server', does not exist. Please check whether the 'PassengerRoot' option is specified correctly.
[Sun Feb 06 08:48:31 2011] [notice] Apache/2.2.14 (Ubuntu) Phusion_Passenger/2.2.7 configured -- resuming normal operations

Am I missing something? I am entirely new to Ruby on Rails and just trying to get this app to be hosted by Apache so I don't have to be logged in on my server for it to run. I don't understand the dependencies Ruby on Rails has in order to work with Apache. If anyone knows of some beginner references for me to learn more about how Ruby on Rails works with Apache, I'd be grateful.

Best Answer

Specify correct PassengerRoot in your apache configuration file. It seems that passenger gem installed not into your home directory or it has other version than 3.0.2.