Config of nginx to filter http flood

前端 未结 3 1608
猫巷女王i
猫巷女王i 2020-12-23 08:52

A have a http flood on my server, not so much queries, but anyway. Queries in log

95.55.237.3 - - [06/Sep/2012:14:38:23 +0400] \"GET / HTTP/1.0\" 200

3条回答
  •  自闭症患者
    2020-12-23 09:05

    Try adding something like the following directives to your config to prevent http flooding:

    http {
      limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
      limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;
    
      server {
        limit_conn conn_limit_per_ip 10;
        limit_req zone=req_limit_per_ip burst=10 nodelay;
      }
    } 
    

    See http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html and http://nginx.org/en/docs/http/ngx_http_limit_req_module.html for more info

    There's all the following directive http://nginx.org/en/docs/http/ngx_http_core_module.html#limit_rate

    NOTE: http://www.botsvsbrowsers.com/details/504401/index.html says the above user agent is not a known bot

提交回复
热议问题