使用了哪个 Nginx 和哪个配置文件

Pau*_*aul 6 configuration nginx ubuntu-12.04

我正在尝试为 Nginx 安装 Phusion 乘客模块。有 Nginx 安装在/usr/sbin/nginx. 安装程序 gem 下载了 Nginx 源代码,并在乘客支持下将它们编译成/opt/nginx/sbin/nginx. 我将此文件复制到/usr/sbin/nginx.

所以目前我不确定哪个 Nginx 正在运行以及我应该编辑哪个配置文件。

有没有办法确定实际使用的 Nginx 的位置以及它使用哪个配置文件?

Flo*_*aie 13

您将能够看到主进程:

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
Run Code Online (Sandbox Code Playgroud)

执行:

$ /usr/sbin/nginx -V 2>&1 | grep --colour=auto conf
Run Code Online (Sandbox Code Playgroud)

它会给你一个 --conf-path=/etc/nginx/nginx.conf 附近的某个地方。


小智 7

~# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Run Code Online (Sandbox Code Playgroud)