nginx快速檢視配置檔案的方法

2021-09-12 23:05:03 字數 1018 閱讀 3964

locate nginx.conf

/usr/local/etc/nginx/nginx.conf

/usr/local/etc/nginx/nginx.conf.default

...

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

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

使用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 且呼叫有效。

nginx快速檢視配置檔案的方法

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!nginx的配置放在nginx.conf檔案中,一般我們可以使用以下命令檢視伺服器中存在的nginx.conf檔案。locate nginx.conf usr local etc nginx nginx.conf usr local etc ngi...

nginx之快速查詢配置檔案

nginx的配置放在nginx.conf檔案中,一般我們可以使用以下命令檢視伺服器中存在的nginx.conf檔案。locate nginx.conf usr local nginx conf nginx.conf usr local nginx conf nginx.conf.default 如果...

nginx配置檔案

執行使用者 user nobody nobody 啟動程序 worker processes 2 全域性錯誤日誌及pid文件 error log logs error.log notice pid logs nginx.pid 工作模式及連線數上限 events 設定http伺服器,利用他的反向 功...