Prevent Rate Limit From Same IP address

My client website was Stop Due to High CPU  Usage . So everyday I need to restart the server. then site go up. 

So I added Rate Limit for same IP adderess . If  hit is more than 5 from same IP address it will limit that  in  AWS ..

Here is the Implementation


 1. Implement Rate Limiting:

Using Apache Rate Limiting:

Enable mod_ratelimit:


sudo a2enmod ratelimit


Configure Rate Limiting for Apache Virtual Host:


Open your Apache configuration file:



sudo nano /etc/apache2/sites-available/your-site.conf


Inside the <VirtualHost> section, add the following lines:


apache


<VirtualHost *:80>

    # other configurations...


    <Location "/">

        SetOutputFilter RATE_LIMIT

        SetEnv rate-limit 1

    </Location>

</VirtualHost>


Adjust the SetEnv rate-limit value according to your desired rate limit.


Restart Apache:


sudo systemctl restart apache2


Now, requests to your WordPress site will be rate-limited based on the configuration you set.

No comments:

Post a Comment

Pages