← All articles

Why Nginx creates a file named "off"?

· 1 min read
🇮🇹This article is also available in Italian.Leggi in italiano →

If you’ve ever found an unexpected file named off under /etc/nginx/, here’s the reason why.

When configuring Nginx, it’s possible to disable error logging. However, the directive must be used correctly:

error_log /dev/null;

If you mistakenly write:

error_log off;

Nginx will interpret off as a file path, not as a keyword, and will try to create (or write to) /etc/nginx/off. That’s why you’ll find an empty file named off in your configuration directory.

This behavior happens because Nginx’s configuration parser does not treat off as a special keyword for the error_log directive. Instead, it expects a file path as the first argument, followed optionally by a log level (like warn, error, or debug).

To disable logging properly, just redirect it to /dev/null, which effectively discards all log output:

error_log /dev/null;

This simple change prevents Nginx from creating the mysterious off file.

Have you ever had this problem? I have 😁 That’s why I decided to write a short post about it.

Erik D'Ercole
Erik D'Ercole
Web developer, sysadmin and DevOps. Partner and co-founder of Encodia.
RSS
Stay up to date
Subscribe to the RSS feed to get new articles in your favourite reader.
RSS feed ↗