Get the App
SLTechnology News&Howtos  ›  Servers  › 

Nginx semaphores (smooth restart / upgrade / reread log)

Shulou Source: shulou.com Published: 2022-06-03 01:49:33 09月22日 Update

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)

Tags: File log smoothing process signal configuration upgrade elegance disk node or semaphore no location name point is in useful space syntax Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn NVidia Huawei OPPO Reno Docker