如何使用 NGINX 阻止泛洪请求?

Dai*_*ail 3 nginx

我在 VPS 中使用 NGINX 作为 Web 服务器,我想将其配置为阻止泛洪请求。我找到了 HttpLimitReqModule 模块,但我需要避免向用户发送回复。

如果请求数高于设置,我看到模块发回 503 http 错误。我可以阻止向用户发送回复吗?我只想关闭连接。

(我认为它要快得多)

谢谢

cad*_*dmi 5

http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#return

停止处理并将指定的代码返回给客户端。非标准代码 444 关闭连接而不发送响应头

http://nginx.org/en/docs/http/ngx_http_limit_req_module.html#limit_req_status

syntax: limit_req_status code;
default: limit_req_status 503;
Run Code Online (Sandbox Code Playgroud)

所以limit_req_status 444;可以帮忙。