/var/log/nginx/*.log {
daily
missingok
rotate 7
compress
delaycompress
notifempty
create 0640 www-data adm
sharedscripts
postrotate
systemctl reload nginx > /dev/null 2>/dev/null || true
endscript
}This configuration rotates nginx logs daily, keeps 7 old logs compressed (due to 'compress' and 'delaycompress'), and reloads nginx after rotation to reopen log files.
If the cron job or systemd timer that runs logrotate is not active, logs won't rotate regardless of configuration.
Option D rotates daily, keeps 14 compressed logs, and compresses immediately because it lacks 'delaycompress'.
Reloading nginx causes it to reopen log files without stopping the service, which is best practice after log rotation.
'delaycompress' keeps the most recent rotated log uncompressed until the next rotation, which helps processes that might still be writing or reading that file.
