Home  >  Article  >  Backend Development  >  How to quickly view nginx configuration files

How to quickly view nginx configuration files

jacklove
jackloveOriginal
2018-06-15 17:45:296400browse

nginx configuration is placed in the nginx.conf file. Generally, we can use the following command to view the nginx.conf file that exists in the server.

locate nginx.conf
/usr/local/etc/nginx/nginx.conf
/usr/local/etc/nginx/nginx.conf.default...

If there are multiple nginx.conf files in the server, we don't know which configuration file is actually called, so wemust find the actual called configuration file can be modified.

View the configuration file actually called by nginx

1. Check the nginx path

ps aux|grep nginx
root              352   0.0  0.0  2468624    924   ??  S    10:43上午   0:00.08 nginx: worker process  root              232   0.0  0.0  2459408    532   ??  S    10:43上午   0:00.02 nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;  
root             2345   0.0  0.0  2432772    640 s000  S+    1:01下午   0:00.00 grep nginx

The path of nginx is: /usr/local/opt/nginx/bin/ nginx

2. Check the nginx configuration file path

Use nginx’s -t parameter to perform a configuration check to know the actual called configuration file path and whether The call works.

/usr/local/opt/nginx/bin/nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

The test shows that the nginx configuration file path is: /usr/local/etc/nginx/nginx.conf and the call is valid.

nginx configuration is placed in the nginx.conf file. Generally, we can use the following command to view the nginx.conf file that exists in the server.

locate nginx.conf
/usr/local/etc/nginx/nginx.conf
/usr/local/etc/nginx/nginx.conf.default...

If there are multiple nginx.conf files in the server, we don't know which configuration file is actually called, so wemust find the actual called configuration file can be modified.

View the configuration file actually called by nginx

1. Check the nginx path

ps aux|grep nginx
root              352   0.0  0.0  2468624    924   ??  S    10:43上午   0:00.08 nginx: worker process  root              232   0.0  0.0  2459408    532   ??  S    10:43上午   0:00.02 nginx: master process /usr/local/opt/nginx/bin/nginx -g daemon off;  
root             2345   0.0  0.0  2432772    640 s000  S+    1:01下午   0:00.00 grep nginx

The path of nginx is: /usr/local/opt/nginx/bin/ nginx

2. Check the nginx configuration file path

Use nginx’s -t parameter to perform a configuration check to know the actual called configuration file path and whether The call works.

/usr/local/opt/nginx/bin/nginx -t
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful

The test shows that the nginx configuration file path is: /usr/local/etc/nginx/nginx.conf and the call is valid.

This article explains how to quickly view the configuration file of nginx. For more related content, please pay attention to the PHP Chinese website.

Related recommendations:

php How to combine multiple one-dimensional arrays into a two-dimensional array

php Return array Method of specifying multiple columns in

Solution to the problem of mysql secure-file-priv option

The above is the detailed content of How to quickly view nginx configuration files. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn