How to control the total requests in Ngnix

tongshushan at migu.cn tongshushan at migu.cn
Thu Nov 30 12:04:41 UTC 2017


Francis,
what is the same "key " for all requests from different client ips for limit_conn_zone/limit_req_zone? I have no idea on this.



Tong
 
From: Francis Daly
Date: 2017-11-30 18:17
To: nginx
Subject: Re: How to control the total requests in Ngnix
On Thu, Nov 30, 2017 at 05:12:18PM +0800, tongshushan at migu.cn wrote:
 
Hi there,
 
> I want to use ngnix to protect my system,to allow max 2000 requests sent to my service(http location).
> The below configs are only for per client ip,not for the total requests control.
 
> ##########method 1##########
> 
> limit_conn_zone $binary_remote_addr zone=addr:10m;
 
http://nginx.org/r/limit_conn_zone
 
If "key" is "$binary_remote_addr", it will be the same for the same
client ip, and different for different client ips; the limits apply to
each individual value of client ip (strictly: to each individual value of
"key").
 
If "key" is (for example) "fixed", it will be the same for every
connection, and so the limits will apply for all connections.
 
Note: that limits concurrent connections, not requests.
 
> ##########method 2##########
> 
> limit_req_zone $binary_remote_addr zone=one:10m rate=10r/s;
 
http://nginx.org/r/limit_req_zone
 
Again, set "key" to something that is the same for all requests, and
the limit will apply to all requests.
 
f
-- 
Francis Daly        francis at daoine.org
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20171130/ce865cb7/attachment.html>


More information about the nginx mailing list