Home  >  Article  >  Operation and Maintenance  >  Where is the configuration file of nginx?

Where is the configuration file of nginx?

尚
Original
2019-07-03 17:09:4922617browse

Where is the configuration file of nginx?

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 do not know which configuration file is actually called, so we must find the actual called configuration file to modify it.

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 configuration file path called and whether the call is valid.

/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.

For more Nginx related knowledge, please visit the Nginx usage tutorial column!

The above is the detailed content of Where is the configuration file of nginx?. 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
Previous article:What can nginx do?Next article:What can nginx do?