Limit Nginx max concurrent connections
Literally moments after I posted this question, I stumbled upon this while googling for how to whitelist IPs from a file in Nginx! Kind of funny considering I spent the last 2 hours googling for specific terms about rate limiting; talk about relevance, heh..
limit_conn_zone $server_name zone=servers:1m;
limit_conn servers 1;
This in the http {
block seems to do the trick.
Related videos on Youtube
w00t
Updated on October 12, 2022Comments
-
w00t over 1 year
I am looking for a way to limit the number of maximum concurrent connections to 1. I do not want a connection limit per IP, I already know this is supported.
As far as I can see, max_conns would be exactly what I'm looking for, but unfortunately it's not available in the free version:
Additionally, the following parameters are available as part of our commercial subscription
Limiting
worker_connections
is not an option, as the minimum it wants is 4, and it affects more than the incoming requests.My conf:
server { listen 80; server_name localhost; location / { rewrite_by_lua ' [some lua code] '; proxy_pass http://127.0.0.1:8080; } }
-
tokland about 6 yearsSee also nginx.org/en/docs/http/…