将以下代码保存至 /etc/logrotate.d/ 目录下,请注意自行替换相关参数。

/usr/local/nginx/logs/*.log {
        weekly
        missingok
        rotate 4
        compress
        delaycompress
        notifempty
        create 0640 www-data
        sharedscripts
        postrotate
            test ! -f /usr/local/nginx/logs/nginx.pid || kill -USR1 `cat /usr/local/nginx/logs/nginx.pid`
        endscript

了解 Starx's Home 的更多信息

订阅后即可通过电子邮件收到最新文章。