• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

nginx快速查看配置文件的方法

php 搞代码 4年前 (2022-01-22) 13次浏览 已收录 0个评论

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 nginxroot              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 -tnginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is oknginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

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

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 nginxroot              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 -tnginx: the configuration file /usr/local/etc/nginx<mark style="color:transparent">本%文来源gaodaimacom搞#^代%!码网@</mark>搞代gaodaima码/nginx.conf syntax is oknginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

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

本文讲解了nginx快速查看配置文件的方法 ,更多相关内容请随时关注我们网站!

相关推荐:

php 多个一维数组合拼成二维数组的方法

php 返回数组中指定多列的方法

mysql secure-file-priv选项问题的解决方法

以上就是nginx快速查看配置文件的方法的详细内容,更多请关注搞代码gaodaima其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:nginx快速查看配置文件的方法
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址