nginx access log logrotate配置
/home/deployuser/deploy/nginx/temp/logs/home.access.log {
size 100M
rotate 100
nocompress
daily
missingok
notifempty
sharedscripts
postrotate
[ ! -f /home/deployuser/deploy/nginx/temp/logs/nginx.pid ] || kill -USR1 `cat /home/deployuser/deploy/nginx/temp/logs/nginx.pid`
endscript
}
保存在/etc/logrotate.d/home中,而logrotate是cronjob每天跑的任務。
postrotate部分是rotate之後通知nginx重新打開日志文件以免丟失日志。