How does Nginx restart after being killed by log-rotate?
logrotate
running as a daily cron job will rename log files in /var/log/nginx/*.log
.After that, nginx cannot output error log or access log to original log files. (For more details, refer to @mata's comment under this answer.)
To solve this problem, USR1
signal should be sent to nginx to reopen log files.That's why postrotate
sends USR1
to nginx master, this signal is not to kill nginx.
For more details to control nginx with signals, see this document.