I want to rate limit PHP requests with "client ip + vhost + same url" but on same servers sometimes I see:
[alert] 78841#0: could not allocate node in limit_req zone "req_limit_per_ip_per_uri"
which causes 429 errors in all domains.
-----
FreeBSD/amd64
-----
# Max connections
events {
worker_connections 16384;
}
# Rate limit
limit_req_zone "$binary_remote_addr$host$request_uri" zone=req_limit_per_ip_per_uri:10m rate=2r/s;
# Vhosts
server {
server_name www.example1.com;
...
location ~ [^/]\.php(/|$) {
...
limit_req zone=req_limit_per_ip_per_uri burst=20 nodelay;
...
}
...
}
server {
server_name www.example2.com;
...
location ~ [^/]\.php(/|$) {
...
limit_req zone=req_limit_per_ip_per_uri burst=20 nodelay;
...
}
...
}
----
Ιs it better to use different variables for key? Which is the max shared memory needed?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx