vim /etc/logrotate.d/nginx
/var/log/nginx/*.log {
daily
missingok
rotate 3
compress
dateext
ifempty
create 600 www www
sharedscripts
postrotate
[ -f /usr/local/nginx/nginx/logs/nginx.pid ] && kill -USR1 `cat /usr/local/nginx/nginx/logs/nginx.pid`
endscript
}
logrotate -vf /etc/logrotate.d/nginx
评论区