Ruby on Rails Ubuntu 8.10: Installing Phusion Passenger

Warning: count(): Parameter must be an array or an object that implements Countable in /nfs/c01/h05/mnt/6385/domains/ on line 65

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 
    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>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www

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

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

    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 ::1/128

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

The last thing to do is restart Apache:

sudo /etc/init.d/apache2 restart