Installing mod_evasive for apache in cPanel server

What is mod_evasive ?

Mod_evasive helps apache to protect the server from DDOS attacks and bruteforce attacks, if you are getting too many attacks you should consider installing it on cPanel/WHM based servers. Follow the below steps to install/configure it:

  • Login to your server
  • Execute following commands:
  • # cd /usr/local/src/
  • # wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz
  • # tar -xvzf mod_evasive_1.10.1.tar.gz
  • # cd mod_evasive
  • # /usr/local/apache/bin/apxs -cia mod_evasive20.c

Now create new file by executing and add the below code into it:

  • # nano /usr/local/apache/conf/mod_evasive.conf

LoadModule evasive20_module modules/mod_evasive20.so
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 10
DOSPageInterval 1
DOSSiteInterval 1
DOSBlockingPeriod 10
</IfModule>

Now include the above file inside /usr/local/apache/conf/includes/pre_main_global.conf

Include “/usr/local/apache/conf/mod_evasive.conf”

  • Rebuild apache configuration files:
  • # /scripts/rebuildhttpdconf
  • Restart Apache:
  • # service httpd restart

And you’re done!

Let me know if you have any issue while installing/configuring mod_evasive.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>