logrotate -f /etc/logrotate.d/nginx

Category: Web Servers & Proxies

logrotate -f /etc/logrotate.d/nginx

Force nginx log rotation immediately

Runs the nginx logrotate rules now instead of waiting for the daily timer, which is handy before an audit or when disk space is tight. The postrotate script calls nginx -s reopen so the server keeps writing to fresh logs. Without -f, logrotate only rotates when the configured age or size is reached.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.