使用logrotate管理Nginx日志配置如下:
[root@vm-10-129-93-51 nginx]# vi /etc/logrotate.d/nginx /letv/log/nginx/*.log { daily dateext missingok rotate 2 compress notifempty create 640 nginx adm sharedscripts postrotate [ -f /var/run/nginx.pid ] && kill -USR1 `cat /var/run/nginx.pid` `cp -f /letv/log/nginx/*.* /letv/log/nginx/backup` endscript } ~