Linux下如何查看定位当前正在运行的Nginx的配置文件


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

[root@xiaoyuer scripts]# netstat -lntup|grep 80
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      13309/nginx 

#可以知道nginx进程是13309

2. 通过相应的进程ID(比如:13309)查询当前运行的nginx路径:

[root@xiaoyuer scripts]# ll /proc/13309/exe 
lrwxrwxrwx 1 root root 0 Jan  4 17:02 /proc/13309/exe -> /data/nginx/sbin/nginx

 3. 获取到nginx的执行路径后,使用-t参数即可获取该进程对应的配置文件路径,如:

/usr/local/nginx/sbin/nginx -t
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

 其实所有的启动命令都是类似 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM