My Quotes

When U were born , you cried and the world rejoiced
Live U'r life in such a way that when you go

Tuesday, July 8, 2014

Prevent DDOS attacks in Apache Web Server

There is an Apache module that was created to prevent a DDoS attack, although it's probably not installed by default. Follow these steps to install the module.

  • Open your terminal window.
  • Issue the command sudo apt-get -y install libapache2-mod-evasive.
  • Issue the command sudo mkdir -p /var/log/apache2/evasive.
  • Issue the command sudo chown -R www-data:root /var/log/apache2/evasive.
  • Open the /etc/apache2/mods-available/mod-evasive.load file (using sudo and your favorite text editor) and append the following to the bottom of that file (this is one configuration per line):

    DOSHashTableSize 2048
    DOSPageCount 20  # maximum number of requests for the same page
    DOSSiteCount 300  # total number of requests for any object by the same client IP on the same listener
    DOSPageInterval 1.0 # interval for the page count threshold
    DOSSiteInterval 1.0  # interval for the site count threshold
    DOSBlockingPeriod 10.0 # time that a client IP will be blocked for
    DOSLogDir "/var/log/apache2/evasive"
  • Save the apache2.conf file and restart Apache so the new module will take effect
  • No comments :