I have searched the whole website and google and couldnt find what i am looking for.
Currently i know that we can limit requests / ip with for example
limit_req_zone $binary_remote_addr zone=one:30m rate=20r/s;
and we can use in any location we want like
limit_req zone=one burst=10 nodelay;
My question is. How do i limit requests globally for all ips at the same time? In short, i have a PHP-FPM location, that i want no matter what, all requests to not exceed 200 requests / second.
I guess we have to replace the $binary_remote_addr, but i have no idea with what.
Make something up, that is unique and won't match anything else.
That field in
limit_req_zone
is just a key, and it's used as a lookup in the specifiedzone
. If you have a static key, then all the lookups will match the same, and the limit for that zone will be effectively global.For example:
Here,
global
has no semantic meaning. It's just a random bit of text. It could beanything
orsomething
ornothing
.