When we install a new program in Nginx, we need to restart it. In fact, there is a little trick when restarting. The kill command is a very magical command. Let's learn how to use the kill command to restart Nginx.
If the machine is slow, Nginx can not kill the kill process when it restarts, and then execute it once. This type of restart is not particularly secure. If the configuration is incorrect, the restart will fail. You need to re-modify the configuration file and then start it again, which will take a while. However, for the http world, which is generally not very strict, this time will not cause too much loss, as long as it is not made at a critical moment. If you want to follow this restart method, I suggest to test it first.
Later I saw a more wonderful Nginx restart on nginx.net
kill -HUP $pid($pid is the process number of the nginx master process)
I generally use this
kill -HUP `cat /data/nginx/logs/nginx.pid`
The advantage of this way is to achieve "smooth restart" in ps-aux As you can see, nginx starts the new process first, and the old process still provides the service. After a while, the old process service is automatically closed after the end of the service, and the new process continues to serve. However, this method is also disadvantageous. If the configuration file is incorrect, or the resource conflicts, the restart fails, but nginx does not have any prompts! This will often find that the changed configuration file does not take effect and it is more difficult to find the problem. //www.45it.com
So, finally mixed the problem, got a nginx.sh, this version of nginx.sh still did not solve the problem of kill -HUP resource conflict, but solved The problem with the configuration file. For resource conflicts, for example, port 80 is occupied, and the log file directory is not created. Refer to the online practice and control with the following script:
#!/bin/sh BASE_DIR='/usr/local/' ${BASE_DIR}nginx/sbin/nginx -t -c ${BASE_DIR}nginx/Conf/nginx. conf >& ${BASE_DIR}nginx/logs/nginx.start info=`cat ${BASE_DIR}nginx/logs/nginx.start` if [ `echo $info
This article takes Serv-U6.4 as an example. Setting method: Double-click to open S
Click on the group and click on New Group in the right frame to creat
This method mainly solves the problem that the MSSQLSERVER service on the local computer starts afte
When the server receives a request for a specific web resource, ASP.NET uses the configuration file
Win2003 comes with mail server configuration
Improve IIS website server efficiency eight methods
Analysis: How to choose servers for SMEs
How video servers work and how they are applied
Linux streaming media Helix Server detailed installation and configuration
I took out the Windows 2003 IIS6 installer
Weapons: Data Center Migration Beware of Four Big Mistakes
IIS logging time is not correct
IIS server application is not available to solve the problem
Deployment of Exchangeerver under Window2008
First intimate contact with Windows services
Win8.1 8.1 keyboard digital lock button does not automatically open the three solutions when booting
Get the win7 system prompt error 1079 fault
Win8 system Chinese version of the Chinese package how to install
Microsoft launches Win8 application and declares war on Google Apple