How to limit number of connections per IP on Nginx?

Solution 1:

According to your configuration, Nginx allows ten connections per second. if you want to limit total connection to Nginx from source IP do this:

it will only allow ten connection for single IP

iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 10 --connlimit-mask 32 -j REJECT --reject-with tcp-reset