logrotate进行nginx的日志轮转
logrotate是linux下自带的日志轮询工具。默认情况下,在/etc/cron.daily/目录下有一个logrotate脚本,我们只要把nginx的轮询脚本放在/etc/logrotate.d/下即可。 1# cat /etc/logrotate.d/nginx 2/usr/local/nginx/logs/*.log { 3daily 4missingok 5rotate 7 6compress 7delaycompress 8notifempty 9sharedscripts 10postrotate 11 kill -USR1 `cat /usr/local/nginx/logs/nginx.pid` 12endscript 13} 注:同样可以发送HUP信号来……