Where Nginx logs are stored

nginx

Updated August 29, 2026

On a standard Ubuntu package installation, Nginx commonly writes:

/var/log/nginx/access.log
/var/log/nginx/error.log

Those are defaults, not guarantees. The active configuration decides the destination with access_log and error_log, and a site can override the paths. Find and test the loaded configuration:

sudo nginx -T | less
sudo nginx -t

Containers may write to stdout/stderr instead, so use the container runtime's log command when Nginx runs in Docker. A custom log_format can also send logs to syslog or another collector. Check ownership and rotation before changing permissions; Ubuntu's logrotate setup normally handles the standard files.

Logs can contain query strings, IP addresses, and authentication mistakes. Restrict access and redact sensitive values at the application/proxy boundary. Do not clear a full log by deleting it while Nginx is writing; use the operating system's rotation procedure or reload after a deliberate rotation.

Sources

related.

Ruslan Osipov

Ruslan Osipov

About the author