There is no logrotate script for nginx with logrotate. Here is my sugestions for /etc/logrotate.d/nginx: /var/log/nginx/* { missingok sharedscripts postrotate if [ -f /var/run/nginx.pid ]; then /etc/init.d/nginx restart > /dev/null fi endscript } Reproducible: Always Steps to Reproduce:
nginx as built-in support for instant log-rotation using USR1 signal: /var/log/nginx/*_log { missingok sharedscripts postrotate kill -USR1 `cat /var/run/nginx.pid` endscript }
(In reply to comment #1) > nginx as built-in support for instant log-rotation using USR1 signal: > > /var/log/nginx/*_log { > missingok > sharedscripts > postrotate > kill -USR1 `cat /var/run/nginx.pid` > endscript > } > I would prefer using /etc/init.d/nginx reload instead of kill for this task. the init script's reload() should also switch from HUP to USR1 - but that's another issue.
About Nginx handling of signals, docs [1] says the following : HUP: `- Configuration reload `-Start the new worker processes with a new configuration `-Gracefully shutdown the old worker processes USR1 `-Reopen the log files USR2 `-Upgrade Executable on the fly So using USR1 to reopen logs after rotation seems sane. [1] http://wiki.nginx.org/NginxCommandLine#Controlling_Nginx_Via_the_Signals
I've added a logrotate script to 0.7.64-r3 (and will port it to 0.8.x soon).