Exclude ip's from Nginx limit_req zone

ASTRAPI nginx-forum at nginx.us
Thu Dec 25 18:32:47 UTC 2014


My english is not so good and sometimes is hard for me sorry :(


So as the goal is to limit globaly the maximum connections from one ip to 15
and to have 40 requests per ip and burst up to 80 requests per second it
should be like this?


Main nginx conf:

http {
limit_req_zone $limit zone=foo:1m rate=40r/s;

geo $limited {
default 1;
192.168.45.56/32 0;
199.27.128.0/21 0;
173.245.48.0/20 0;
103.21.244.0/22 0;
103.22.200.0/22 0;
103.31.4.0/22 0;
141.101.64.0/18 0;
108.162.192.0/18 0;
190.93.240.0/20 0;
188.114.96.0/20 0;
197.234.240.0/22 0;
198.41.128.0/17 0;
162.158.0.0/15 0;
104.16.0.0/12 0;
}

map $limited $limit {
1 $binary_remote_addr;
0 "";
}


And on domain conf:

server {
limit_req zone=foo burst=80;


If not can you please post a configuration that will do that?

Thanks

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,255697,255794#msg-255794



More information about the nginx mailing list