如何使用limit_conn和limit_req禁用nginx日志记录?

时间:2013-07-12 20:37:07

标签: nginx

如何从HttpLimitConnModule和HttpLimitReqModule中完全禁用日志记录?

至少限制在DOS攻击情况下广泛记录所造成的损害。我仍然想要一些错误记录,但是当请求被拒绝时却没有。

此类消息: 2013/07/12 20:20:10 [error] 31544#0: *78 limiting requests, excess: 0.519 by zone "limit", client: *.*.*.*, server: example.com, request: "GET /static.html HTTP/1.1", host: "example.com", referrer: ""

1 个答案:

答案 0 :(得分:0)

一种解决方案是在需要的地方启用error_log。

server {
    error_log   /dev/null crit;

    location ~\.php$ {
        error_log   /var/log/nginx_error.log;
    }
}
相关问题