Denial of Service, commonly known as the DDoS attack, is one of the biggest threats for your servers security. In a DoS attack, attackers with destructive intentions try overloading the server with requests more than the server can handle. The attacker is able to find holes in the security of the server and exploit it to carry out the attack.
How to avoid DoS attacks using mod_evasive ?
mod_evasive can be an efficient method of avoiding a DoS attack. It is one of the modules available for an Apache http server, which comes for free.
How to install mod_evasive over your Linux Hosting server ?
Note: Before proceeding with the installation, it is important that the server is running Apache.
- You are required to login to the server via SSH as root
- Ensure that the Apache is updated with the latest development files. Use the below command to install http-devel package on your server
yum install httpd-devel
- Using the following command, you must download the updated version
- Then use the below command for extracting the archived files:
tar xvzf mod_evasive_1.10.1.tar.gz mod_evasive/
- Then compile the module using the following command :
/usr/sbin/apxs -cia /usr/src/mod_evasive/mod_evasive20.c
- For activating the module, fire the below command
chmod 755 /usr/lib/httpd/modules/mod_evasive20.so
- You must then restart Apache
- Ensure that it has been loaded correctly
grep -i evasive /etc/httpd/conf/httpd.conf
- The result should be :
LoadModule evasive20_module /usr/lib/httpd/modules/mod_evasive20.so Run : php -r ‘phpinfo();’ | grep -i evasive
- The mod_evasive should get listed
- Now the Apache conf file: /etc/httpd/conf/httpd.conf should be updated with adding configuration rules
<IfModule mod_evasive20.c>DOSHashTableSize 3097DOSPageCount 6DOSSiteCount 100DOSPageInterval 2DOSSiteInterval 2DOSBlockingPeriod 600</IfModule
You can also go through the documentation for determining the best configuration settings for each. This should help you avoid a DoS attack on your server.