How to check the location of nginx configuration file

王林
Release: 2023-05-29 16:13:06
forward
5133 people have browsed it

How can we easily and quickly find the location of the configuration file for an unfamiliar server or if we have forgotten the location after installing it for too long? To find out the location of the configuration file, you need to first find out the path to the nginx executable file. Here are several methods:

1. If the program is running ps -ef | grep nginx # ps - ef | grep nginx root 29514...

For an unfamiliar server or if you have forgotten the location after installing it for a long time, how can you easily and quickly find the location of the configuration file?
To find out the location of the configuration file, you need to first find out the path to the nginx executable file.

There are several methods here:

1. If the program During operation

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
Copy after login

Usually /usr/sbin/nginx

2. The program is not running

Check the software installation path

whereis nginx

Query the path where the running file is located

which nginx

Of course there are other query methods

rpm package If it is installed, you can use rpm -qa | grep "software or package name" to query;
If it is installed with yum method, you can use yum list installed to find it;

Get the configuration file location

After finding the path of the nginx executable file through some of the above methods, you can find the location of the configuration file through nginx's own functions.

# /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
Copy after login

The above is the detailed content of How to check the location of nginx configuration file. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!