For an unfamiliar server or the installation has been too long to forget the location, how can we easily and quickly find the location of the configuration file?
To find out the location of the configuration file, you need to find the path to the nginx executable first,
Here are a few ways:
1. If the program is running
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 does not run
View the software installation path
whereis nginx
Query the path where the running file is located
which nginx
Of course there are other ways to query
rpm package installed, you can use rpm -qa | grep "software or package name" query;
yum method installed, you can use yum list installed to find;
Get configuration file location
Through some of the above methods, after finding the path of the nginx executable file, you can find the location of the configuration file through the functions of Nginx itself.