Code: Select all
curl -O https://c.myvestacp.com/tools/rate-limit-tpl/install_rate_limit_tpl.sh
bash install_rate_limit_tpl.sh
This installer will install hosting-firewall.tpl (nginx template) that will:
- allow 1 http request per second per IP address (sent to your server, more precisely to your PHP-FPM)
- allow 2 parallel http connections per IP address (sent to your PHP-FPM)
- allow burst for 7 additional http requests (they will enter queue), first 3 will be processed immediately, 4 others will processed each request each second (so this will handle natural peaks that CMS can generate to itself)
- if client fills allowed queue, additional requests will be denied
There are also 3 additional templates, with larger limit values (for example: 2 req/sec, 14 allowed requests in queue, 7 burst, 8 parallel connections).
There are also firewall-wordpress templates adapted for WordPress sites.
If you need different rate-limit for different IP addresses and optionally for different folders - see solution here: viewtopic.php?p=2686#p2686