Linux查看正在运行的nginx的配置文件

1. 查看nginx的PID,以端口80为例

[root@localhost opt]# netstat -lntup|grep 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      2246/nginx  

2. 通过相应ID查询当前nginx的运行路径

[root@localhost opt]# ll /proc/2246/exe
lrwxrwxrwx. 1 root root 0 Nov 29 22:22 /proc/2246/exe -> /usr/local/nginx/sbin/nginx

3. 使用-t获取该进程对应的配置文件路径

[root@localhost opt]# /proc/2246/exe -t
ngx_http_fastdfs_set pid=2420
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful

你可能感兴趣的:(Linux,Linux,Nginx)