Install and configure mod_evasive on FreeBSD
DoS pretection module for Apache.
cd /usr/ports/www/mod_evasive && sudo make config-recursive install distclean
Open Apache config file:
sudo ee /usr/local/etc/apache24/httpd.conf
Ensure the following directive is uncommented (by removing any #
prefix if present) to activate mod_evasive
:
LoadModule evasive20_module libexec/apache24/mod_evasive20.so
Create and open mod_evasive.conf
:
sudo ee /usr/local/etc/apache24/Includes/mod_evasive.conf
Add the following and replace example@example.com
with the required email address, save and exit:
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSPageInterval 1
DOSSiteCount 50
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify example@example.com
</IfModule>
Restart Apache for changes to take effect:
sudo apachectl graceful