by Paramjit

Goto Terminal and follow the below given process.

1. sudo apt-get install libapache2-mod-evasive

2. if you want mod_evasive to email you when a DDOS attack occurs. Then create a static link to sendmail becuase mod_evasive expects sendmail to be located at “/bin/mail”
sudo ln -s /usr/sbin/sendmail /bin/mail

3. Make a directory for mod_evasive to store the log files and chown it to www-data. Open the mod_evasive config file add the lines below and enter your email address.
mkdir /var/log/apache2/mod_evasive
vi /etc/apache2/conf.d/modevasive
<ifmodule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSLogDir /var/log/apache2/mod_evasive
DOSEmailNotify EMAIL@DOMAIN.com
DOSWhitelist 127.0.0.1
</ifmodule>

4. Enable mod_evasive:
sudo a2enmod mod-evasive

5. Now restart Apache
/etc/init.d/apache2 restart

6. Test it through given below command
perl /usr/share/doc/libapache2-mod-evasive/examples/test.pl

Install and configure mod_evasive

Leave a Reply

Your email address will not be published. Required fields are marked *