Ruby on Rails Ubuntu 8.10: Installing Phusion Passenger

Phusion Passenger™ — a.k.a. mod_rails or mod_rack — makes deployment of Ruby web applications, such as those built on the revolutionary Ruby on Rails web framework, a breeze. It follows the usual Ruby on Rails conventions, such as “Don’t-Repeat-Yourself”.

After setting up Ubuntu 8.10 and installing Rails, I executed the following steps to get Passenger installed.

Install Phusion Passenger:

sudo gem install passenger
sudo passenger-install-apache2-module

Upon success, passenger should return you the following response:

The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:
    LoadModule passenger_module 
        /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6
    PassengerRuby /usr/bin/ruby1.8

To do as passenger instructs:

sudo vi /etc/apache2/sites-enabled/000-default

Opening that file, I added the “ServerName” at the beginning and Rails/Passenger items at the end of the file. I also cleaned up some of the spacing (for cleanliness sake).

<VirtualHost *:80>
    ServerName glenfiddich-u.parallel21.com
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>

    ErrorLog /var/log/apache2/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"

    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    RailsEnv development
		
    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.6
    PassengerRuby /usr/bin/ruby1.8
</VirtualHost>

The last thing to do is restart Apache:

sudo /etc/init.d/apache2 restart