nginx logrotate script

nginx logrotate script

Create a new file at /etc/logrotate.d/nginx with contents:


/var/log/nginx/*.log {
        daily
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 640 root adm
        sharedscripts
        postrotate
                [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat
/var/run/nginx.pid`
        endscript
}

Run Logrotate

# /etc/cron.daily/logrotate

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.