Howto Install mod_evasive

Download the source
wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz
tar -xzvf mod_evasive_1.10.1.tar.gz
cd mod_evasive

Compile in the mod_evasive apache module using apxs
For Apache 2
/usr/local/apache/bin/apxs -i -a -c mod_evasive20.c

For Apache 1.3
/usr/local/apache/bin/apxs -i -a -c mod_evasive.c

If the apxs path is not /usr/local/apache/bin/apxs replace it with the appropriate path

Edit your httpd.conf /usr/local/apache/conf/httpd.conf

Add the lines below.

======================
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
DOSEmailNotify user@yourdomain.com
======================

/etc/init.d/httpd restart

You can try another values for the above and obtain the best setting.
In some cases mod_evasive also blocks legitimate user IPs.