Nginx unknown directive for passenger_root

None of the answers on this page helped me with 18.04 LTS and passenger 6.0.1. I followed the official guide over at https://www.phusionpassenger.com/library/install/nginx/install/oss/bionic/ and that solved this issue for me. It looks like the process of installation has changed since the last few answers were posted.

These commands will install Passenger + Nginx module through Phusion's APT repository. At this point we assume that you already have Nginx installed from your system repository. If not, you should do that first before continuing.

sudo apt-get install -y dirmngr gnupg
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates

sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update

sudo apt-get install -y libnginx-mod-http-passenger

enable the Passenger Nginx module and restart Nginx

if [ ! -f /etc/nginx/modules-enabled/50-mod-http-passenger.conf ]; then sudo ln -s /usr/share/nginx/modules-available/mod-http-passenger.load /etc/nginx/modules-enabled/50-mod-http-passenger.conf ; fi

sudo ls /etc/nginx/conf.d/mod-http-passenger.conf

Check installation

sudo /usr/bin/passenger-config validate-install

I'm install nginx-extras and put include /etc/nginx/modules-enabled/*.conf; before event {...} section.

OS: ubuntu 18.04 server


I ran into the same thing. I had accidentally installed the nginx-extras package that is normally provided by Ubuntu, rather than the one provided by Phusion Passenger's repository. The Passenger package has Passenger compiled with Nginx as a module, while the other package does not.

The solution is to add Phusion Passenger's apt repository, then install the nginx-extras package from it. The method of doing this differs slightly depending on your Linux distro and version so you should read the documentation first: https://www.phusionpassenger.com/library/install/nginx/apt_repo/

If reading the documentation is a problem for you then you can try the commands I used to add the repository and install the nginx-extras package from it.

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
sudo apt-get install -y apt-transport-https ca-certificates
sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger trusty main > /etc/apt/sources.list.d/passenger.list'
sudo apt-get update
sudo apt-get install -y nginx-extras