查找正在運行的nginx目錄

linux系統由於備份、不一樣版本等問題,致使ECS Linux上存放有多個Nginx目錄,能夠經過以下方法定位當前正在運行的Nginx的配置文件:linux


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

netstat -anop | grep 0.0.0.0:80


2. 經過相應的進程ID(好比:4562)查詢當前運行的nginx路徑:
spa

 ll  /proc/4562/exe

 


3. 獲取到nginx的執行路徑後,使用-t參數便可獲取該進程對應的配置文件路徑,如:
code

 

# /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
相關文章
相關標籤/搜索