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

Vue2.0 implements adaptive resolution

This article shares the specific code of Vue2.0 t...

Detailed explanation of the core concepts and basic usage of Vuex

Table of contents introduce start Install ① Direc...

Introduction to Docker Quick Deployment of SpringBoot Project

1. Install Docker First open the Linux environmen...

MySQL table name case selection

Table of contents 1. Parameters that determine ca...

Tutorial on installing jdk1.8 on ubuntu14.04

1. Download jdk download address我下載的是jdk-8u221-li...

Mybatis implements SQL query interception and modification details

Preface One of the functions of an interceptor is...

HTML tag marquee realizes various scrolling effects (without JS control)

The automatic scrolling effect of the page can be...

Vue keeps the user logged in (various token storage methods)

Table of contents How to set cookies Disadvantage...

An article to understand operators in ECMAScript

Table of contents Unary Operators Boolean Operato...

JavaScript to implement the aircraft war game

This article shares with you how to use canvas an...

Html and CSS Basics (Must Read)

(1) HTML: HyperText Markup Language, which mainly...

Implementation of communication between Vue and Flask

Install axios and implement communication Here we...

Records of using ssh commands on Windows 8

1. Open the virtual machine and git bash window a...