کد:
Login to web server via SSH.
For Apache 2.0.x, execute the following command:
up2date -i httpd-devel
Continue with the following commands one by one for all version of Apache HTTPD server. wget command will download the current stable version 1.10.1 source tarball.
cd /usr/local/src
wget http://www.zdziarski.com/projects/mod_evasive/mod_evasive_1.10.1.tar.gz
tar -zxvf mod_evasive_1.10.1.tar.gz
cd mod_evasive
For Apache 2.0.x , execute the following command:
/usr/sbin/apxs -cia mod_evasive20.c
Else, for Apache 1.3.x,
/usr/local/apache/bin/apxs -cia mod_evasive.c
Above commands will compile mod_evasive to .so and subsequently add corrensponding AddModule and LoadModule lines into httpd.conf.
mod_evasive comes with default configuration value preset, however, if webmasters want to configure and set the value themselves, the following parameters have to be added into httpd.conf Apache configuration file below the AddModule section.
For Apache 2.0.x, add the following text to httpd.conf below AddModule section:
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 100
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 600
</IfModule>
For apache 1.3.x, add the following text to httpd.conf below AddModule section:
<IfModule mod_evasive.c>
DOSHashTableSize 3097
DOSPageCount 5
DOSSiteCount 100
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 600
</IfModule>
Save and exit the httpd.conf Apache configuration file.
Restart the Apache server with the following command:
/etc/init.d/httpd restart
Note: If apxs is not found, it can be installed via “yum install httpd-devel” command.