(go) Smooth change nginx configuration without stopping Nginx service

Source: Internet
Author: User

Smooth change of nginx configuration without stopping Nginx service
1. After modifying the/usr/local/webserver/nginx/conf/nginx.conf configuration file, execute the following command to check if the configuration file is correct:
/usr/local/webserver/nginx/sbin/nginx-t

If the screen displays the following two lines of information, the configuration file is correct:
The configuration file/usr/local/webserver/nginx/conf/nginx.conf syntax is OK
The configuration file/usr/local/webserver/nginx/conf/nginx.conf was tested successfully
2. Smooth restart:
①, for Nginx 0.8.x version, now smooth restart Nginx configuration is very simple, execute the following command:


/usr/local/webserver/nginx/sbin/nginx-s Reload

②, for the previous version of Nginx 0.8.x, smooth restart a little more trouble, follow the steps below. Enter the following command to view the Nginx main process number:


Ps-ef | grep "Nginx:master Process" | Grep-v "grep" | Awk-f ' {print $} '

The screen displays the Nginx main process number, for example:
6302
At this point, execute the following command to make the modified Nginx configuration file effective:


Kill-hup 6302

Or do not need to be so troublesome to find the Nginx PID file:


Kill-hup ' Cat/usr/local/webserver/nginx/nginx.pid '

(go) Smooth change nginx configuration without stopping Nginx service

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.