nginx配置文件的所在位置怎么看

对于一台陌生的服务器或安装太久忘了位置,怎么才能简单快速的找到配置文件的位置呢?要找出配置文件的位置,需要先找出nginx可执行文件的路径 , 这里有几种方法:

1、如果程序在运行中 ps -ef | grep nginx # ps -ef | grep nginx root 29514…

对于一台陌生的服务器或安装太久忘了位置,怎么才能简单快速的找到配置文件的位置呢?
要找出配置文件的位置,需要先找出nginx可执行文件的路径 ,

这里有几种方法:

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

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享