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
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
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!