/var/log/nginx/*.log {
        weekly
        missingok
        copytruncate
        rotate 12
        compress
        notifempty
        sharedscripts
        postrotate
           if [ -f /var/run/nginx.pid ] && ps --pid $(cat /var/run/nginx.pid) > /dev/null 2>&1; then \
             if [ -x /usr/sbin/invoke-rc.d ]; then \
                invoke-rc.d nginx reload > /dev/null 2>&1; \
             else \
                /etc/init.d/nginx reload > /dev/null 2>&1; \
             fi; \
           fi;
        endscript
}
