1. 程式人生 > >nginx檢視配置檔案

nginx檢視配置檔案

ginx快速檢視配置檔案的方法 https://blog.csdn.net/fdipzone/article/details/77199042 nginx的配置放在nginx.conf檔案中,一般我們可以使用以下命令檢視伺服器中存在的nginx.conf檔案。 locate nginx.conf /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx.conf.default …

如果伺服器中存在多個nginx.conf檔案,我們並不知道實際上呼叫的是哪個配置檔案,因此我們必須找到實際呼叫的配置檔案才能進行修改。

檢視nginx實際呼叫的配置檔案 1.檢視nginx路徑 ps aux|grep nginx root 352 0.0 0.0 2468624 924 ?? S 10:43上午 0:00.08 nginx: worker process root 232 0.0 0.0 2459408 532 ?? S 10:43上午 0:00.02 nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off; root 2345 0.0 0.0 2432772 640 s000 S+ 1:01下午 0:00.00 grep nginx

nginx的路徑為:/usr/local/opt/nginx/bin/nginx

2.檢視nginx配置檔案路徑 使用nginx的 -t 引數進行配置檢查,即可知道實際呼叫的配置檔案路徑及是否呼叫有效。

/usr/local/opt/nginx/bin/nginx -t nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

測試可知,nginx的配置檔案路徑為:/usr/local/etc/nginx/nginx.conf 且呼叫有效。