Disable nginx logs

2019-03-27 18:45发布

How to disable nginx logging, without crit errors?

error_log off - doesnt works, just creates filename "off", really, not joke.

error_log dev/null doesnt supports.

OS freebsd. I need disable logging for subdomain.

标签: nginx logging
3条回答
一纸荒年 Trace。
2楼-- · 2019-03-27 19:22

http://wiki.nginx.org/CoreModule#error_log

From wiki

Note that error_log off does not disable logging - the log will be written to a file named "off". To disable logging, you may use:

error_log /dev/null crit;

查看更多
相关推荐>>
3楼-- · 2019-03-27 19:39

To disable NGINX access and error log for all latest NGINX version

  http {

          access_log off;
          error_log off;

       }
查看更多
我欲成王,谁敢阻挡
4楼-- · 2019-03-27 19:47

Set the logging to stderr (the redirect to /dev/null does not work reliably since from version 0.7.53 /var/log/nginx/error.log) is hardcoded to be used until the config file has been read (http://wiki.nginx.org/CoreModule#error_log).

error_log stderr crit;

Using /dev/null on systems where /var/log/nginx/* doesn't exist will cause nginx to quit.

查看更多
登录 后发表回答