How to view nginx configuration file path and resource file path

How to view nginx configuration file path and resource file path

View the nginx configuration file path

Through nginx -t

The original function of the nginx -t command is to verify whether there are any abnormalities in the format and configuration of the nginx configuration file. This command will output the path and verification results of the nginx configuration file. In the output results, you can find the address of the current nginx loaded configuration file, as shown below:

nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

From this we can see that the nginx configuration file is in the folder /etc/nginx/nginx.conf

Use ps -ef | grep nginx

If the loading path of the nginx configuration file is explicitly configured during the nginx startup process, you can easily see the current configuration file loading path in this way

Use the locate command to search

If the locate command is installed on the server, you can use the locate nginx.conf command to search, but if there are multiple nginx.conf files, it is difficult to determine which nginx configuration file is loaded.

Search through the nginx -V command

You can see all the configuration information during installation through the nginx -V command. By looking for the --conf-path configuration information inside, you can find the path of the corresponding configuration file, as shown below:

nginx -V

nginx version: nginx/1.12.2
built by gcc 8.2.1 20180905 (Red Hat 8.2.1-3) (GCC) 
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --add-module=/usr/local/src/headers-more-nginx-module-0.33 --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-http_auth_request_module --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

View nginx resource file path

Through the nginx -V command

Use the nginx -V command, and then find the --prefix= configuration returned in the command. The path corresponding to the configuration is the path of the nginx resource file.

This is the end of this article about how to view the nginx configuration file path and resource file path. For more relevant nginx configuration file path content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of the mechanism and implementation of accept lock in Nginx
  • Solve the problem of Nginx returning 404 after configuring proxy_pass
  • Solution to Nginx SSL certificate configuration error
  • Nginx 502 Bad Gateway Error Causes and Solutions
  • Proxy_pass method in multiple if in nginx location
  • Nginx configuration sample code for downloading files
  • Implementation of nginx multiple locations forwarding any request or accessing static resource files
  • Detailed explanation of the implementation of nginx process lock

<<:  JavaScript to achieve dynamic color change of table

>>:  Vue uses the Element el-upload component to step on the pit

Recommend

MySQL efficient query left join and group by (plus index)

mysql efficient query MySQL sacrifices group by t...

Disable IE Image Toolbar

I just tried it on IE6, and it does show the toolb...

Diving into JS inheritance

Table of contents Preface Prepare Summarize n way...

Simple implementation method of vue3 source code analysis

Table of contents Preface 🍹Preparation 🍲vue3 usag...

Python3.6-MySql insert file path, the solution to lose the backslash

As shown below: As shown above, just replace it. ...

MySQL json format data query operation

The default table name is base_data and the json ...

Detailed configuration of Nginx supporting both Http and Https

It is almost a standard feature for websites nowa...

MySQL variable declaration and stored procedure analysis

Declaring variables Setting Global Variables set ...

Detailed explanation of how to use Vue to load weather components

This article shares with you how to use Vue to lo...

Optimizing the slow query of MySQL aggregate statistics data

Written in front When we operate the database in ...

A brief discussion on the application of Html web page table structured markup

Before talking about the structural markup of web...

7 Ways to Write a Vue v-for Loop

Table of contents 1. Always use key in v-for loop...

Differences between MySQL MyISAM and InnoDB

the difference: 1. InnoDB supports transactions, ...