How to install rate-limit nginx templates

Post Reply
User avatar
dpeca
Site Admin
Posts: 553
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
How to install rate-limit nginx templates

Post by dpeca »

As root, in SSH run:

Code: Select all

curl -O https://c.myvestacp.com/tools/rate-limit-tpl/install_rate_limit_tpl.sh
bash install_rate_limit_tpl.sh

Tags:

User avatar
dpeca
Site Admin
Posts: 553
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Re: How to install rate-limit nginx templates

Post by dpeca »

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
Generally, this nginx template will prevent bad bots to run hundreds parallel http requests against your site, which will probably cause denial-of-service on your server.

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).

Jpsciolli
Posts: 8
Joined: Sun Feb 21, 2021 6:54 pm
Re: How to install rate-limit nginx templates

Post by Jpsciolli »

Hello, just got this error while installing it...

install_rate_limit_tpl.sh: line 57: service: command not found

Anything usefull unattended?

User avatar
dpeca
Site Admin
Posts: 553
Joined: Fri Jun 19, 2020 9:59 am
Your location: Serbia, Niš and Belgrade
First name and last name: Predrag Damnjanović
Re: How to install rate-limit nginx templates

Post by dpeca »

Jpsciolli wrote:
Thu Aug 05, 2021 10:09 pm
Hello, just got this error while installing it...

install_rate_limit_tpl.sh: line 57: service: command not found

Anything usefull unattended?

Code: Select all

apt-get install sysvinit-utils
echo "PATH=$PATH:/usr/sbin" >> ~/.bashrc
source ~/.bashrc
then run rate-limit installer again.


Post Reply