How to install mod_evasive on Linux server

Go to the below path.

cd /usr/local/src

Download the file using the below link:

wget wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz

Untar the file.

tar xzf mod_evasive_1.10.1.tar.gz

Go to the folder.

cd mod_evasive

Run the below command for the installation.

apxs -cia mod_evasive20.c

 

You’ll then need to add the mod_evasive configuration to your Apache configuration file. First, find this section:

File:/etc/httpd/conf/httpd.conf (CentOS / Fedora)

LoadModule evasive20_module /usr/lib/httpd/modules/mod_evasive20.so

Below those sections, add the mod_evasive configuration:

File excerpt:mod_evasive configuration

<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 60
DOSEmailNotify [email protected]
</IfModule>

————————————————————

File:/etc/apache2/apache2.conf (Debian / Ubuntu)

# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf
————————————————————-

You’ll then need to restart Apache for your changes to take effect:

Debian / Ubuntu:

/etc/init.d/apache2 restart

CentOS / Fedora:

/etc/init.d/httpd restart