cd /etc/logrotate.d/
grep ^adm /etc/group
vi nginx
/var/log/nginx/*.log {
daily
missingok
rotate 14
compress
delaycompress
notifempty
create 0640 nginx adm
sharedscripts
postrotate
invoke-rc.d nginx rotate >/dev/null 2>&1
endscript
}
and fix the group and user accordingly (adm to let developers read their logs…)
debian nginx pkg -- 0640 www-data adm
nginx from source -- 0640 nginx adm
ls -alhF /var/log/nginx/
logrotate -v /etc/logrotate.d/nginx
https://www.learn2torials.com/a/how-to-rotate-nginx-logs –> used example
https://www.digitalocean.com/community/tutorials/how-to-configure-logging-and-log-rotation-in-nginx-on-an-ubuntu-vps –> more tuning
https://www.nginx.com/resources/wiki/start/topics/examples/logrotation/ –> another trick to reopen
https://ubiq.co/tech-blog/how-to-configure-nginx-log-rotation/ –> another example