• Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
logo logo
  • Home
  • Cloud VPS
    • Hong Kong VPS
    • US VPS
  • Dedicated Servers
    • Hong Kong Servers
    • US Servers
    • Singapore Servers
    • Japan Servers
  • Company
    • Contact Us
    • Blog
ENEN
  • 简体简体
  • 繁體繁體
Client Area

Apache for Newbie: Set up mod_evasive against DDoS

December 17, 2023

Apache for Newbie: Set up mod_evasive against DDoS

As a newbie to the world of VPS hosting, it’s important to understand the various security measures you can take to protect your server. One such measure is setting up mod_evasive, an Apache module that helps defend against Distributed Denial of Service (DDoS) attacks. In this article, we’ll walk you through the process of setting up mod_evasive on your Hong Kong VPS Hosting server.

What is mod_evasive?

Mod_evasive is an Apache module that provides evasive action in the event of an HTTP DoS or DDoS attack or brute force attack. It is designed to be a detection and network management tool, and can provide an additional layer of security to your hosting environment.

How does mod_evasive work?

Mod_evasive works by monitoring incoming requests to your server and blocking IP addresses that make too many requests within a short period of time. It can also detect when a single IP address is making multiple concurrent requests, which is a common characteristic of a DDoS attack.

Setting up mod_evasive

Setting up mod_evasive on your Hong Kong VPS server is a straightforward process. Here’s how to do it:

Step 1: Install mod_evasive

First, you’ll need to install mod_evasive on your server. You can do this by running the following command:

sudo apt-get install libapache2-mod-evasive

Step 2: Configure mod_evasive

Once mod_evasive is installed, you’ll need to configure it to suit your needs. You can do this by editing the mod_evasive configuration file, which is located at /etc/apache2/mods-available/evasive.conf. Here’s an example of what your configuration file might look like:

<IfModule mod_evasive20.c>
    DOSHashTableSize    3097
    DOSPageCount        2
    DOSSiteCount        50
    DOSPageInterval     1
    DOSSiteInterval     1
    DOSBlockingPeriod   10
</IfModule>

In this example, the DOSPageCount directive is set to 2, which means that if a single IP address requests the same page more than twice in one second, it will be blocked. The DOSBlockingPeriod directive is set to 10, which means that the IP address will be blocked for 10 seconds.

Step 3: Test mod_evasive

Once you’ve configured mod_evasive, it’s important to test it to make sure it’s working properly. You can do this by using a tool like ApacheBench to simulate a DDoS attack on your server. Here’s an example of how to use ApacheBench:

ab -n 100 -c 10 http://yourdomain.com/

This command will send 100 requests to your server, with 10 concurrent requests. If mod_evasive is working properly, it should block the IP address that is making the requests.

Conclusion

Setting up mod_evasive on your Hong Kong VPS Hosting server is an important step in protecting your server from DDoS attacks. By monitoring incoming requests and blocking IP addresses that make too many requests within a short period of time, mod_evasive can provide an additional layer of security to your cloud environment. With the steps outlined in this article, you should be able to set up mod_evasive on your server and test it to make sure it’s working properly.

Recent Posts

  • How to Migrate from CentOS 8 to AlmaLinux or Rocky Linux Safely
  • CentOS Server Performance Tuning: Optimization Techniques for 2026
  • How to Configure SELinux in CentOS Without Breaking Your System (CentOS Stream 9/10 – 2026)
  • Managing Users and Permissions in CentOS Stream: Best Practices (CentOS Stream 9/10 – 2026)
  • How to Set Up Nginx on CentOS Stream for High-Performance Web Hosting

Recent Comments

No comments to show.

Knowledge Base

Access detailed guides, tutorials, and resources.

Live Chat

Get instant help 24/7 from our support team.

Send Ticket

Our team typically responds within 10 minutes.

logo
Alipay Cc-paypal Cc-stripe Cc-visa Cc-mastercard Bitcoin
Cloud VPS
  • Hong Kong VPS
  • US VPS
Dedicated Servers
  • Hong Kong Servers
  • US Servers
  • Singapore Servers
  • Japan Servers
More
  • Contact Us
  • Blog
  • Legal
© 2026 Server.HK | Hosting Limited, Hong Kong | Company Registration No. 77008912
Telegram
Telegram @ServerHKBot