limit_conn module exclude also on Maxim Dunin recommended code

ASTRAPI nginx-forum at nginx.us
Sun Jan 4 14:44:19 UTC 2015


Hi

I am using this code to limit requests and exclude some ip's"

http {

limit_req_zone $limit zone=delta:8m rate=60r/s;

geo $limited {
default 1;
192.168.45.56/32 0;
199.27.128.0/21 0;
173.245.48.0/20 0;
}

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


And this on the domain config:

server {

limit_req zone=delta burst=90 nodelay;


Now i have two questions:

1)Does nginx realy knows how to exclude ip's in this format .0/21 or i must
use them as 199.27.128.5 for example? 

199.27.128.0/21

2)Now i want to use the limit_conn_zone on the above recommendation from
Maxim Dunin...

like this:

http {

limit_conn_zone $binary_remote_addr zone=alpha:8m;
limit_req_zone $limit zone=delta:8m rate=60r/s;

geo $limited {
default 1;
192.168.45.56/32 0;
199.27.128.0/21 0;
173.245.48.0/20 0;
}

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


And this on the domain config:

server {

limit_conn alpha 20;
limit_req zone=delta burst=90 nodelay;

But how i can use the above exclude list for the limit_conn module also?

Thanks

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



More information about the nginx mailing list