I am trying to install Phusion Passenger module for Nginx. There was Nginx installed in /usr/sbin/nginx. The installer gem downloaded Nginx sources and compiled them with Passenger support into /opt/nginx/sbin/nginx. I copied this file into /usr/sbin/nginx.

So currently I am in doubt which Nginx is running and which config file I should edit.

Is there some way to determine the location of actually used Nginx and which configuration file does it use?


You shall be able to see the master process:

florin@vm:~$ ps aux | grep nginx
root       884  0.0  0.0  76944  1308 ?        Ss   10:28   0:00 nginx: master process /usr/sbin/nginx

The execute:

$ /usr/sbin/nginx -V 2>&1 | grep --colour=auto conf

It shall give you a --conf-path=/etc/nginx/nginx.conf somewhere around there.

| improve this answer | |
  • The -V flag will show the location of the conf file that Nginx was complied to use (i.e. the default), but it's possible that it's running another one, either supplied on the command line with -c (which ps aux would reveal), or another means, e.g. see how can i change nginx Configuration file path. – Demitri Jul 8 '19 at 4:13
~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.