Nginx server restart script

nginx is a super stable server. Generally, it will not need to be restarted due to overload problems. The purpose of restarting is generally to load after modifying the configuration file. At the beginning, I used the most direct way to restart killall -9 nginx;/data/nginx/sbin/nginx If the machine is relatively slow, the kill process cannot be killed in an instant, just execute it again. This restart method is not particularly safe. If the configuration is wrong, the restart will fail, and the configuration file needs to be modified before restarting, which will take a little time. However, for the currently generally not very strict http industry, this time will not cause too much loss, as long as it is not done at a critical moment. If you want to continue to use this restart method, I suggest that you should test it first. Later I saw a more fantastic restart on nginx.net kill -HUP $pid ($pid is the process number of the nginx master process) I usually use it like this kill -HUP `cat /data/nginx/logs/nginx.pid` The advantage of this method is to achieve “smooth restart”, in ps In -aux, it can be seen that nginx starts a new process first,…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索