arrow_backward Back to blog

Deploying your Rails applications with Phusion Passenger

There have been several methods to deploy an Ruby on Rails application. Until recently, the most popular is to run Apache and proxy balance to multiple Mongrel instances that are running simultaneously.

Passenger, developed by Phusion, is the new kid entering the Rails deployment market. Everyone has been using the Apache PHP module for years and deploying a PHP applications is a snap. This has not been possible with Rails until Passenger. It is extremely easy, and you can still use Capistrano to automate deployment. I will show you how I get it to work on Ubuntu.

Update: Phusion just released Passenger 2.0 RC 1. You can download this version and do gem install passenger-1.9.0.gem instead. But I had an error compiling it on Mac OS X Leopard. hongli pointed me to use the version from GitHub that has the fix and it works like a charm. Thanks Phusion guys.

To get it from GitHub:

I created a separate /etc/apache2/mods-available/passenger.load and it contains the following:

For 1.0.5:

For the GitHub version (Of course the path will look different depending on where your git clone is):

I then tell Apache to load the Passenger module:

Now, I create a virtual host configuration for one of my Rails app in /etc/apache2/sites-available/myapp:

I then restart Apache:

When you need to restart your application because you have changed some code that Rails does not reload in production, just do:

I have not tried their Ruby Enterprise Edition yet. They claim substantial memory and speed improvement at RailsConf 2008, so it will be interesting to see how that develops.


New Project Request