Home > Backend Development > PHP Tutorial > How to quickly view nginx configuration files

How to quickly view nginx configuration files

jacklove
Release: 2023-04-01 12:22:02
Original
6436 people have browsed it

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...
Copy after login
Copy after login

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
Copy after login
Copy after login

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
Copy after login
Copy after login

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...
Copy after login
Copy after login

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
Copy after login
Copy after login

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
Copy after login
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template