nginx快速查看配置文件的方法(实际的调用的配置文件)-----推荐阅读

nginx的配置放在nginx.conf文件中,一般我们可以使用以下命令查看服务器中存在的nginx.conf文件。

<span style="color:#000000"><code>locate nginx.conf
/usr/local/etc/nginx/nginx.conf
/usr/local/etc/nginx/nginx.conf.default
<span style="color:#000088 !important">...</span></code></span>

如果服务器中存在多个nginx.conf文件,我们并不知道实际上调用的是哪个配置文件,因此我们必须找到实际调用的配置文件才能进行修改。
 

查看nginx实际调用的配置文件

1.查看nginx路径

<span style="color:#000000"><code>ps aux|grep nginx
root              <span style="color:#006666 !important">352</span>   <span style="color:#006666 !important">0.0</span>  <span style="color:#006666 !important">0.0</span>  <span style="color:#006666 !important">2468624</span>    <span style="color:#006666 !important">924</span>   ??  S    <span style="color:#006666 !important">10</span>:<span style="color:#006666 !important">43</span>上午   <span style="color:#006666 !important">0</span>:<span style="color:#006666 !important">00.08</span> nginx: worker <span style="color:#4f4f4f !important">process</span>  
root              <span style="color:#006666 !important">232</span>   <span style="color:#006666 !important">0.0</span>  <span style="color:#006666 !important">0.0</span>  <span style="color:#006666 !important">2459408</span>    <span style="color:#006666 !important">532</span>   ??  S    <span style="color:#006666 !important">10</span>:<span style="color:#006666 !important">43</span>上午   <span style="color:#006666 !important">0</span>:<span style="color:#006666 !important">00.02</span> nginx: master <span style="color:#4f4f4f !important">process</span> /usr/<span style="color:#4f4f4f !important">local</span>/opt/nginx/bin/nginx -g daemon off;  
root             <span style="color:#006666 !important">2345</span>   <span style="color:#006666 !important">0.0</span>  <span style="color:#006666 !important">0.0</span>  <span style="color:#006666 !important">2432772</span>    <span style="color:#006666 !important">640</span> s000  S+    <span style="color:#006666 !important">1</span>:<span style="color:#006666 !important">01</span>下午   <span style="color:#006666 !important">0</span>:<span style="color:#006666 !important">00.00</span> grep nginx</code></span>

nginx的路径为:/usr/local/opt/nginx/bin/nginx
 

2.查看nginx配置文件路径

使用nginx的 -t 参数进行配置检查,即可知道实际调用的配置文件路径及是否调用有效。

<span style="color:#000000"><code>/usr/<span style="color:#000088 !important">local</span>/opt/nginx/bin/nginx -t
nginx: <span style="color:#000088 !important">the</span> configuration <span style="color:#d19a66">file</span> /usr/<span style="color:#000088 !important">local</span>/etc/nginx/nginx.conf syntax <span style="color:#000088 !important">is</span> ok
nginx: configuration <span style="color:#d19a66">file</span> /usr/<span style="color:#000088 !important">local</span>/etc/nginx/nginx.conf test <span style="color:#000088 !important">is</span> successful</code></span>

测试可知,nginx的配置文件路径为:/usr/local/etc/nginx/nginx.conf 且调用有效。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值