Detailed explanation of how to find the location of the nginx configuration file

Detailed explanation of how to find the location of the nginx configuration file

How can you find the location of the configuration file quickly and easily for an unfamiliar server or if you have forgotten where it was installed so long ago? To find out the location of the configuration file, you need to first find the path to the nginx executable file. There are several ways to do this:

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

How can you find the location of the configuration file quickly and easily for an unfamiliar server or if you have forgotten where it was installed so long ago?
To find out the location of the configuration file, you need to first find the path to the nginx executable file.

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 is not running

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

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

Get the configuration file location

Through the above methods, we can find the path of the nginx executable file, and then 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

Do you have a better way?

Summarize

The above is a detailed explanation of the method I introduced to you to find the location of the nginx configuration file. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

You may also be interested in:
  • A brief analysis of the writing and use of variables in the Nginx configuration file
  • Chinese comments on Nginx's nginx.conf configuration file
  • Detailed explanation of nginx configuration file in Chinese
  • Introduction to Nginx configuration and configuration files under Windows
  • Nginx server configuration file complete analysis
  • Detailed explanation of Nginx configuration file
  • Detailed explanation of Nginx configuration file
  • Nginx configuration file detailed explanation and optimization suggestions guide

<<:  MySQL 5.7.20\5.7.21 free installation version installation and configuration tutorial

>>:  How to set default value for datetime type in MySQL

Recommend

How to express relative paths in Linux

For example, if your current path is /var/log and...

An example of installing MySQL on Linux and configuring external network access

Configuration steps 1. Check whether DNS is confi...

SQL implementation of LeetCode (196. Delete duplicate mailboxes)

[LeetCode] 196.Delete Duplicate Emails Write a SQ...

JS uses canvas technology to imitate echarts bar chart

Canvas is a new tag in HTML5. You can use js to o...

Detailed explanation of loop usage in javascript examples

I was bored and sorted out some simple exercises ...

Docker dynamically exposes ports to containers

View the IP address of the Container docker inspe...

Some useful meta setting methods (must read)

<meta name="viewport" content="...

How to handle images in Vue forms

question: I have a form in Vue for uploading blog...

The connection between JavaScript constructors and prototypes

Table of contents 1. Constructors and prototypes ...

Use and optimization of MySQL COUNT function

Table of contents What does the COUNT function do...

24 Practical JavaScript Development Tips

Table of contents 1. Initialize the array 2. Arra...