Introduction to nginx
nginx is a high-performance http and reverse proxy server, and is also an imap/pop3/smtp proxy server. nginx is developed by the Russian rambler.ru site, and official tests have shown that nginx can support 50,000 concurrent users.
nginx official website:
This article mainly explains how to control nginx after it is running so that it can be stopped or restarted.
// 启动和停止nginx 当前目录:/usr/local/bin/nginx 启动: ./sbin/nginx 停止 : kill -int master 主机进程号
nginx semaphore
nginx mainly controls nginx through semaphores. The main process number is written to the file nginx.pid by default. You can modify the configuration file nginx .conf changes the name of the modified file.
The signals supported by the nginx main process are as follows:
Semaphore usage method
Detailed explanation
term,int :kill -term (int) nginx main process number or kill -term (int)
`cat/usr/local/nginx/logs/nginx.pid `, The nginx process is shut down immediately and cannot completely process the request of the user using nginx, which is equivalent to /usr/local/nginx -s stop
quit:kill -quit The nginx main process number gracefully shuts down the nginx process, and then shuts down the nginx process after processing all requests from users using nginx, which is equivalent to /usr/local/nginx -s quit
hup:kill -hup nginx main process number nginx process does not close, but reloads the configuration file. Equivalent to /usr/local/nginx -s reload
usr1:kill -usr1 nginx main process number You can reread the log without closing the nginx process. This command can be used for nginx log scheduled backup, press Time intervals such as month/day are useful
usr2:kill -usr2 nginx main process number nginx version needs to be upgraded, nginx can be upgraded without stopping nginx
winch:kill -winch nginx main process number cooperates with usr2 to upgrade nginx, and gracefully closes the old version of nginx process.
The above is the detailed content of Nginx signal control example analysis. For more information, please follow other related articles on the PHP Chinese website!