Apache
Install mod-evasive
sudo apt install libapache2-mod-evasive
Add mod_evasive to VirtualHost
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 60
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify <hyperreal@moonshadow.dev
</IfModule>
Restart apache2.
sudo systemctl restart apache2.service