Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of signal Control in Nginx

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the example analysis of signal control in Nginx, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Introduction to Nginx

Nginx is a high-performance HTTP and reverse proxy server, as well as a proxy server for IMAP/POP3/SMTP. Nginx is developed by the Russian Rambler.ru site, and the official test Nginx can support 50, 000 concurrency.

Nginx official website: http://nginx.org

This article mainly explains how to control Nginx after running so that it can be stopped or restarted.

/ / start and stop nginx current directory: / usr/local/bin/nginx start:. / sbin/nginx stop: kill-INT master host process number

Nginx semaphore

Nginx mainly uses semaphores to control Nginx. The main process number is written into the file nginx.pid by default, and the name of the file can be modified by modifying the configuration file nginx.conf.

The signals supported by the Nginx main process are as follows:

Semaphore usage mode

Specific explanation

TERM,INT: kill-TERM (INT) nginx main process number or kill-TERM (INT)

`cat/usr/local/nginx/logs/nginx.pid', the process of nginx is immediately shut down and cannot fully process the requests of users of the nginx being used, which is equivalent to / usr/local/nginx-s stop

The QUIT:kill-QUIT nginx main process number gracefully shuts down the nginx process, and then shuts down the nginx process after processing all nginx user requests, which is equivalent to / usr/local/nginx-s quit

HUP:kill-HUP nginx main process number the nginx process does not close, but reloads the configuration file. Equivalent to / usr/local/nginx-s reload

The USR1:kill-USR1 nginx main process number can reread the log without shutting down the nginx process. This command can be used for regular backup of nginx logs, and it is useful to split the logs according to monthly / daily intervals.

When the version of USR2:kill-USR2 nginx main process number nginx needs to be upgraded, you can upgrade nginx without stopping nginx.

WINCH:kill-WINCH nginx main process number works with USR2 to upgrade nginx, gracefully shutting down the old version of nginx process.

Using these semaphores of Nginx, you can control the log division of nginx and the upgrade of nginx when you don't have to close the process. With the gradual deepening of Nginx, I feel that only 50, 000 lines of code in Nginx can do this. I really admire it!

The above is all the contents of the article "sample Analysis of signal Control in Nginx". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report