My first adventure with phusion passenger

I spent more than a day stuck with using phusion passenger for a production deployment of an app I made for a client. This is a short note to remind myself of it in future and to help anyone stuck with the same.

The symptoms were pretty bad. Phusion passenger “simply did not work” with nginx. The standalone mode works like a charm, but nginx integration mode gives me directory listings, serves files in public, but does not start the app at all. Nothing in nginx logs to help. The server config is perfectly fine, checked it a hundred times, and tried a bazillion variations.

The problem: A missing passenger_root directive in http block of nginx.conf. I haven’t found anywhere that it is necessary, and given that I used phusion passenger’s repository to install nginx and passenger, I expected the setup to work out of the box.

If your passenger-deployed app doesn’t seem to start at all, just check if your http block has the passenger_root directive. In my case, it had to be set to /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini.  It might be different in your case, just do a locate phusion_passenger/locations.ini to get the appropriate path.

After two days of scratching my head, reading through nginx and passenger docs a dozen times, just added it on a whim and it now works! I can now sleep in peace.

Also, look at passenger_nodejs if you use nvm. You don’t need system-wide node if your passenger_nodejs points to the proper node binary.

This post also highlighted the need for better config If I intend to blog about code. Not being able to visually distinguish code-snippets and inlined commands is a big bummer.


3 thoughts on “My first adventure with phusion passenger

  1. Hi, I’m Hongli Lai, one of the Phusion Passenger authors. I’m sorry that it caused you a headache during installation. I would like to point out that the installation manual does mention passenger_root. From, section 2.3.2 (“Installing or upgrading on Debian or Ubuntu -> Installing packages”):

    > Step 3: Edit /etc/nginx/nginx.conf and uncomment passenger_root and passenger_ruby.

    However, I realize that this instruction assumes that you didn’t already have an nginx.conf before, perhaps from a previous Nginx installation. In that case I can imagine that it’s not obvious that you have to add it. I’ll update the manual accordingly and make it clear that passenger_root is necessary, and how to find the correct value if a commented-out version wasn’t already in nginx.conf.


Comments are closed.