Updating nginx with Passenger module

Installing Passenger with nginx was very painless as shown in my last post setting up a Rails stack on Ubuntu, but unfortunately, the current version of Passenger will install nginx 1.0.0. I needed to be able to set environment variables for the continuous integration server I was building, which required a later version with the latest being 1.0.4.

The first thing you want to do is set your system up to install nginx:

$ sudo apt-get install libpcre3 libpcre3-dev
$ wget http://nginx.org/download/nginx-1.0.4.tar.gz
$ tar zxf nginx-1.0.4.tar.gz

Although passenger helps us install the older version of nginx by default, we can choose the more advanced option of installing the one we just downloaded by first entering this command:

$ rvmsudo passenger-install-nginx-module

When prompted, choose to select your own version of nginx, enter the source location and install it to /usr/local/nginx. If you had followed my previous blog post, you may have noticed that Passenger installs nginx to /opt/nginx by default, so you may want to delete that whole folder off later.

At the end of the installation, you will be asked to copy and paste these two lines into your config file:

passenger_root /home/app_user/.rvm/gems/ree-1.8.7-2011.03/gems/passenger-3.0.7;
passenger_ruby /home/app_user/.rvm/wrappers/ree-1.8.7-2011.03/ruby;

Note that the second line is really important for some reason especially if you are using RVM. I had thought to fill that in myself, but without the wrapper it did not work. Also, don’t copy and paste these lines; you probably have a different version of Ruby installed, so use the ones suggested in the install.

  1. jaryl posted this