8

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?

Paul
  • 243
  • 1
  • 5
  • 15
  • A good answer weren't possible without a good question. Please upvote both if you would like to upvote the answer. – Paul Sep 14 '21 at 18:34

2 Answers2

15

You shall be able to see the master process with:

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

Then 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.

bathyscapher
  • 105
  • 4
Florin Asăvoaie
  • 6,932
  • 22
  • 35
  • 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](https://serverfault.com/questions/821284/how-can-i-change-nginx-configuration-file-path). – Demitri Jul 08 '19 at 04:13
9
~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful