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

Nginx semaphores (smooth restart / upgrade / reread log)

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

Share

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

TERM, INT

Quick shutdown

QUIT

Graceful shutdown gracefully shuts down the process, that is, it closes after the request is completed.

HUP

Configuration reload, Start the new worker processes with

A new configuration Gracefully shutdown the old worker processes

Change the profile and reread the profile smoothly

USR1

Reopen the log files rereads the log, which is useful when the log is split by month / day

USR2

Smooth upgrade of Upgrade Executable on the fly

WINCH

Gracefully shutdown the worker processes gracefully shuts down old processes (upgrades with USR2)

Specific grammar:

Kill-the main process number of the signal option nginx

Kill-HUP 4873

Kill-signal control `cat / xxx/path/log/ nginx.pid`

Kil;-USR1 `cat / xxx/path/log/ nginx.pid`

Smooth restart:

Do not check the smooth restart of the process number:

Kill-HUP `cat logs/ nginx.pid` (within the logs/ under the nginx installation path)

In linux, a file corresponds to a node, which is the real location on disk. Nginx points to that node (disk space) even if the log file is renamed when reading / writing to the log file. So, create a new file and tell nginx to read / write the new log file.

(even if the name is changed, it is still written to the log by nginx.)

Correct operation of rereading the log (ps aux | after the process number is found by grep nginx):

The-t option tests whether the configuration file is written incorrectly

Of course, you can also use the-s option to manipulate semaphores:

(nginx-s reload restarts smoothly)

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