NGinx Logrotate

Written by James McDonald

March 6, 2014

When you start creating virtual hosts under NGinx and give them separate access and error logs don’t forget to update the logrotate configuration otherwise your logs just keep growing.

I have named my logs with .access and .error extensions instead of the default .log option so that has necessitated the following change to the /etc/logrotate.d/nginx file

/var/log/nginx/*log /var/log/nginx/*access /var/log/nginx/*error {
    daily
    rotate 10
    missingok
    notifempty
    compress
    sharedscripts
    postrotate
        /bin/kill -USR1 $(cat /var/run/nginx.pid 2>/dev/null) 2>/dev/null || :
    endscript
}

0 Comments

Submit a Comment

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

You May Also Like…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...

WizTree

Just downloaded WizTree (not a sponsor) from https://wiztreefree.com/ It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...