Install Mod_evasivemod_evasive is an evasive maneuvers module for Apache that provides evasive action in the event of an HTTP DoS attack or brute force attack. If there is too many connections from an ip the offending ip will be blocked.
You can follow the steps listed below to install this module.
========
cd /opt
wget
http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gztar -xvf mod_evasive_1.10.1.tar.gz
cd mod_evasive
=========
Now if you are running Apache 1.3.x you need to execute the following.
/usr/local/apache/bin/apxs -cia mod_evasive.c
If you are on Apache 2.x.x issue the following command.
/usr/local/apache/bin/apxs -cia mod_dosevasive20.c
Restart httpd.
/etc/rc.d/init.d/httpd restart
Done. Now we can go to the configuration part.
If you are on Apache 1.3.x, add the following to the httpd.conf AddModule section:
<IfModule mod_evasive.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 300
</IfModule>
If you are on Apache 2.x.x just scroll to below the LoadModule section in the httpd.conf and add the following:
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 2
DOSSiteInterval 2
DOSBlockingPeriod 300
</IfModule>
Save and exit. Restart httpd.
/etc/rc.d/init.d/httpd restart