Skip to content

Instantly share code, notes, and snippets.

@Nevon
Forked from tejasbubane/nginx
Created July 25, 2016 11:45
Show Gist options
  • Save Nevon/3be7cfa5208c806d76001bb015f8b65c to your computer and use it in GitHub Desktop.
Save Nevon/3be7cfa5208c806d76001bb015f8b65c to your computer and use it in GitHub Desktop.
nginx logrotate script for centOS. Location: /etc/logrotate.d/nginx. Later change /etc/logrotate.conf add daily and change or comment "rotate" number (preferably comment to keep all log files -> symlinked to /mnt so no space issue)
/opt/nginx/logs/*.log {
daily
missingok
rotate 52
compress
delaycompress
notifempty
create 640 root adm
sharedscripts
postrotate
[ ! -f /opt/nginx/logs/nginx.pid ] || kill -USR1 `cat /opt/nginx/logs/nginx.pid`
endscript
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment