当前位置:   article > 正文

nginx 快速查看配置文件路径的方法_nginx 判断是否带有路径

nginx 判断是否带有路径


#查看nginx服务路径

ps aux|grep nginx
  • 1
root      66635  0.0  0.0  13136  1148 pts/0    S+   00:05   0:00 grep --color=auto nginx
root      88067  0.0  0.3 134172  6552 ?        Ss   Sep08   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_p 
  • 1
  • 2

nginx的路径为:/usr/sbin/nginx

#查看nginx配置文件路径

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

/usr/sbin/nginx -t
  • 1
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
  • 1
  • 2

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

#nginx配置文件include其他配置文件

nginx 的配置很灵活,支持include配置文件,如果配置内容过多, 这个文件就会比较乱, 也影响管理和阅读.所以直接拆分出来,分成不同的配置文件;怎么实现呢 ?直接include:

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites/pstest.conf;
  • 1
  • 2

所以,如果在主配置文件里找不到想要的配置信息,可以看看是否include其他配置文件;


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/254398
推荐阅读
相关标签
  

闽ICP备14008679号