Nginx unknown directive for passenger_root
Asked Answered
N

3

21

I'm running into an error when I try to restart the server. I don't know how to fix this.

deploy@user:~$ sudo nginx -s reload
nginx: [emerg] unknown directive "passenger_root" in /etc/nginx/nginx.conf:66

I added these lines to the nginx configuration file '/etc/nginx/nginx.conf'

passenger_root /home/deploy/.rvm/gems/ruby-2.0.0-p353/gems/passenger-4.0.37;
passenger_ruby /home/deploy/.rvm/gems/ruby-2.0.0-p353/wrappers/ruby;
Nashner answered 17/2, 2014 at 22:38 Comment(9)
How did you install nginx? maybe it doesn't have passenger supportInterlink
At first I install it that way rvmsudo passenger-install-nginx-module than I reinstall it 'apt-get passenger'Nashner
check nginx -V (capital v) and see if it has passenger moduleInterlink
no it doesn't have itNashner
idk you seem to have installed it the correct way, but idk why it isn't working.Interlink
should I remove nginx and reinstalll it?Nashner
is it possible that you have 2 different nginx installed?Interlink
yes I have install nginx than I removed itNashner
let us continue this discussion in chatInterlink
D
25

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
Denison answered 18/4, 2014 at 7:3 Comment(5)
so... what is the solution?Dipeptide
The solution is to add Phusion Passenger's apt repository, then install the nginx-extras package from it. There are instructions on how to do this on their website: phusionpassenger.com/documentation/…Denison
please give commands ... if you know how to do it just say don't redirect to the ubuntu docs ... who is going to read them all ?Spendable
Dude, I wrote the commands right after the words "..you can try the commands I used to add the repository and install the nginx-extras package from it."Denison
2 signatures not checked due to missing keys.Microcurie
A
13

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

OS: ubuntu 18.04 server

Aileenailene answered 2/8, 2018 at 20:58 Comment(2)
this work, it should be inside /etc/nginx/nginx.conf before the event section!Irresoluble
If you're e.g. upgrading from 16.04 and keeping your nginx.conf because it has changes, and you've not reviewed the differences between the proposed version and your version carefully enough (as I didn't), then this is what you need.Grape
H
6

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
Hyperostosis answered 22/1, 2019 at 16:26 Comment(1)
A link to a solution is welcome, but please ensure your answer is useful without it: add context around the link so your fellow users will have some idea what it is and why it’s there, then quote the most relevant part of the page you're linking to in case the target page is unavailable. Answers that are little more than a link may be deleted.Desberg

© 2022 - 2024 — McMap. All rights reserved.