This article is a mirror article of machine translation, please click here to jump to the original article.

View: 13608|Reply: 1

[Web] Ways to test if nginx is configured correctly

[Copy link]
Posted on 12/4/2014 5:36:23 PM | | |
The following is an introduction to the method of checking whether the nginx configuration file is correct, in nginx to check the configuration file, mainly use the nginx -t command, for reference of friends who need it.


How to checknginx configurationIs it correct? usenginx-t command.

1. Several command parameters of nginx
Nginx is installed with only one program file and does not provide various hypervisors in its own right, it uses parameters and system signaling mechanisms to control the Nginx process itself.

Nginx's parameters include:
You can use the /usr/local/nginx/sbin/nginx -parameter like this

-c<path_to_config>: Use the specified configuration file instead of nginx.conf in the conf directory.

-t: Test whether the configuration file is correct, this command is very important when you need to reload the configuration at runtime, to detect whether the modified configuration file has syntax errors.

-v: Displays the nginx version number.

-V: Displays the version number of nginx along with the compilation environment information and the parameters at the time of compile.

2. Detect the new conf file

Test if the current nginx.conf file is correct, using the command:


[mw_shl_code=bash,true] [root@localhost]/usr/local/nginx/conf# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful[/mw_shl_code]

Getting such a result indicates that the new conf file is error-free.

If there is an error, it will indicate which line went wrong, and then correct the error.






Previous:Thousands of QQ account passwords and secret protections, speed grab!
Next:Teach you to display your name or the name of the person you like in the lower right corner of the computer
Posted on 12/7/2014 5:25:11 PM |
Reading and posting back is a virtue
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com