Upgrading Passenger + Nginx
through source tarball

This guide teaches you how to upgrade Passenger + Nginx to the latest version. It assumes that Passenger + Nginx was installed through a source tarball. Is this not the case? Go back to the upgrade guide index.

Table of contents

  • Loading...

Upgrade instructions

Step 1: download and extract latest tarball

Download the latest Passenger source tarball.

Download tarball

Extract the tarball to the same directory as where your current Passenger installation is located. For example, if Passenger was located in /opt/passenger-5.0.12, then extract the tarball to /opt. Replace X.X.X with the Passenger version you downloaded.

$ tar -xzvf passenger-X.X.X.tar.gz -C /opt

Step 2: update Passenger PATH entry

While installing the previous Passenger version, you added its bin directory to PATH, so that your shell can locate the previous Passenger version's commands. You need to update this PATH entry to point to the latest Passenger.

Open your shell's system-wide startup file. If you're using bash, this is usually /etc/bashrc or /etc/bash.bashrc. Inside that file, look for something like this:

PATH=/opt/passenger-PREVIOUS-VERSION-NUMBER/bin:$PATH

Replace it with:

PATH=/opt/passenger-CURRENT-VERSION-NUMBER/bin:$PATH

When you're done, restart all your shells so that your new PATH takes effect.

Make sure your bashrc is actually included by your bash profile, which might not be the case if you created the user with useradd instead of adduser for example.

Step 3: re-run the Passenger Nginx module installer

Re-run the Passenger Nginx module installer in order to upgrade Nginx and its Passenger module to the latest version. Follow the on-screen instructions:

$ passenger-install-nginx-module

When done, don't forget to update the configuration snippet in your Nginx config file, as instructed by the installer.

Make sure you preserve the Nginx prefix!

At some point, you will be asked to provide an Nginx "prefix directory". You were asked the same question the last time you installed Passenger + Nginx through source tarball. Make sure that you enter the same directory this time. It's usually /opt/nginx.

Step 4: restart Nginx

Restart Nginx using the following command. Note reloading Nginx is not enough; it must really be a restart.

$ sudo kill $(cat /opt/nginx/logs/nginx.pid)
$ sudo /opt/nginx/sbin/nginx

Be sure to replace /opt/nginx with the actual Nginx prefix that you installed Nginx to.

Step 5: remove old version

Remove the previous Passenger version:

$ sudo rm -rf /opt/passenger-X.X.X

Step 6: validate installation

After installation, please validate the install by running sudo passenger-config validate-install. For example:

$ sudo passenger-config validate-install
 * Checking whether this Phusion Passenger install is in PATH... ✓
 * Checking whether there are no other Phusion Passenger installations... ✓

All checks should pass. If any of the checks do not pass, please follow the suggestions on screen.

Finally, check whether Nginx has started the Passenger core processes. Run sudo passenger-memory-stats. You should see Nginx processes as well as Passenger processes. For example:

$ sudo passenger-memory-stats
Version: 5.0.8
Date   : 2015-05-28 08:46:20 +0200
...

---------- Nginx processes ----------
PID    PPID   VMSize   Private  Name
-------------------------------------
12443  4814   60.8 MB  0.2 MB   nginx: master process /usr/sbin/nginx
12538  12443  64.9 MB  5.0 MB   nginx: worker process
### Processes: 3
### Total private dirty RSS: 5.56 MB

----- Passenger processes ------
PID    VMSize    Private   Name
--------------------------------
12517  83.2 MB   0.6 MB    PassengerAgent watchdog
12520  266.0 MB  3.4 MB    PassengerAgent server
12531  149.5 MB  1.4 MB    PassengerAgent logger
...

If you do not see any Nginx processes or Passenger processes, then you probably have some kind of installation problem or configuration problem. Please refer to the troubleshooting guide.