如何查找nginx配置文件的位置

这篇文章给大家介绍如何查找nginx配置文件的位置,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。

邱县ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为创新互联的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18982081108(备注:SSL证书合作)期待与您的合作!

这里有几种方法:

1、如果程序在运行中

ps -ef | grep nginx
# ps -ef | grep nginx 
root   29514   1 0 Mar01 ?    00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 29515 29514 0 Mar01 ?    00:00:00 nginx: worker process
root   30276 28948 0 09:36 pts/1  00:00:00 grep --color=auto nginx

通常是 /usr/sbin/nginx

2、程序并没有运行

查看软件安装路径

whereis nginx

查询运行文件所在路径

which nginx

当然还有另外的查询方法

rpm包安装的,可以用rpm -qa | grep “软件或者包的名字”查询;
yum方法安装的,可以用yum list installed查找;

获取配置文件位置

通过上面的一些方法,找到了nginx可执行文件的路径,就可以通过Nginx自身的功能找到配置文件的位置了。

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

关于如何查找nginx配置文件的位置就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。


网站栏目:如何查找nginx配置文件的位置
分享路径:http://pwwzsj.com/article/gjseih.html