In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "what is the Nginx process management", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what Nginx process management has.
Nginx process management: signal
There are master process, worker process and Nginx command line that can send and process signals.
First, let's take a look at the Master process.
Master process
Because the master process starts the worker process, the first way it manages the worker process is to monitor whether the worker process sends a CHLD signal, because the Linux operating system stipulates that when the child process terminates, the CHLD signal will be sent to the parent process, so if the worker process causes the worker process to terminate unexpectedly due to some module code bug, then the master process can immediately find such an event through CHLD and then pull the worker process back up.
The Master process also manages the worker process by receiving signals.
The signals that are acceptable to the Master process are:
TERM, INT: stop the Nginx process immediately QUIT: stop the Nginx process gracefully and do not immediately send the end connection request to the user (such as the reset reset request in TCP) HUP: indicates that the configuration file is overloaded USR1: means to reopen the log file and cut the log file USR2: use WINCH specifically for hot deployment: means to exit all worker processes gracefully
Among them, the pink signals USR2 and WINCH can only be sent through the kill command line of Linux, that is, we need to find the PID where the master process is located, send USR2 or WINCH to this PID, and the other four have corresponding Nginx commands.
Worker process
Signals are not usually sent directly to the worker process, because we want the master process to manage the worker process. Although sending a signal directly to the worker process will also cause the worker process to produce the same result, it is usually not done. It is often managed by the master process. After receiving the signal, the master process will send the signal to the worker process.
Nginx Command Line
After Nginx starts, Nginx puts his PID in a file. By default, it is recorded in the / logs/nginx.pid file in the Nginx installation directory, recording the PID of Nginx's master process.
When we use a command line like nginx-s again, then the nginx tool command line will read the PID of the master process in the PID file and send the same HUP, USR1, TERM, QUIT signals to the PID, and such commands correspond to the commands reload, reopen, stop, quit, so calling the nginx command line has the same effect as sending the signal directly with kill.
At this point, I believe you have a deeper understanding of "what Nginx process management has". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
Public static synchronized List getVerifyListInfo (byte [] b) {List signatureVerificat
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.