Passenger - Introduction and Setup

May 20, 2008

Category: sysadmin

Passenger aka mod-rails is an apache module for rails deployment. This documents how I set this up on my Ubuntu server.

Get Passenger

I used gem to install passenger. Running as root

gem install passenger

This installed passenger 1.0.5. To then setup passenger I ran

passenger-install-apache2-module

This runs an installation program that is really very good. The first thing it did was check dependencies. I was missing a couple, and my initial attempt at installing the missing packages failed. So I had to update my system. Again as root

 apt-get update
 apt-get upgrade

After that installing the missing packages worked fine.

Changes from Apache Upgrade

Before I continue, I have to deal with the changes the upgrade to Apache caused. The upgrade introduced an envvars file to the apache configuration and changed the default config file to use these new environment variables. Accepting these changes meant I had to put back a bit of config into apache2.conf

server-name little-un

Loading Passenger

Re-running passenger setup found all dependencies and then provided 3 lines of config to put into my apache configuration

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server
RailsRuby /usr/bin/ruby1.8

I put the first line in /etc/apache2/mods-available/mod_passenger.load and the others in /etc/apache2/mods-available/mod_passenger.conf. Then I enabled the mod, tested the config and restarted apache

a2enmod mod_passenger
apache2ctl configtest
apache2ctl restart

Finally I tested that my current websites were working OK