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

Detailed explanation of using JavaScript WeakMap

A WeakMap object is a collection of key/value pai...

Detailed explanation of how to create an array in JavaScript

Table of contents Creating Arrays in JavaScript U...

Hover zoom effect made with CSS3

Result:Implementation code: html <link href=&#...

Vue example code using transition component animation effect

Transition document address defines a background ...

In-depth understanding of the matching logic of Server and Location in Nginx

Server matching logic When Nginx decides which se...

Nginx cache files and dynamic files automatic balancing configuration script

nginx Nginx (engine x) is a high-performance HTTP...

Echarts Basic Introduction: General Configuration of Bar Chart and Line Chart

1Basic steps of echarts Four Steps 1 Find the DOM...

Use Rem layout to achieve adaptive

I have written an article about mobile adaptation...

How to deploy python crawler scripts on Linux and set up scheduled tasks

Last year, due to project needs, I wrote a crawle...

How to quickly modify the root password under CentOS8

Start the centos8 virtual machine and press the u...

Tutorial on downloading, installing, configuring and using MySQL under Windows

Overview of MySQL MySQL is a relational database ...

Example of Vue routing listening to dynamically load the same page

Table of contents Scenario Analysis Development S...

Detailed examples of replace and replace into in MySQL into_Mysql

MySQL replace and replace into are both frequentl...