mod_slotlimit is an Apache module that using dynamic slot allocation algorithm and static rules, can manage resources used for each running site.
Step 1. Preparing Your system
In order to compile mod_slotlimit, you will need to have apxs2 (APache eXtension tool) installed and configured with Apache.
Use the following command to install
apt-get install apache2-prefork-dev build-essential
Step 2. Download the source package from here
wget http://kent.dl.sourceforge.net/sourceforge/mod-slotlimit/mod_slotlimit.tar.gz
Step 3. Open archive, compile and install module with those commands:
tar zxvf mod_slotlimit.tar.gz
cd mod_slotlimit-1.1
make
make install
Step 4. Load Module
echo “LoadModule slotlimit_module /usr/lib/apache2/modules/mod_slotlimit.so” >> /etc/apache2/httpd.conf
Step 5. Configuring mod_slotlimit
AvailableSlotsPercent – Percentage of apache slots available in order to activate dynamic slot allocation algorithm
MaxConnectionsPerSite – Max connections for each running site
LimitSite – Specific site to limit
LimitSiteConnections – Max connections for “LimitSite”
ClientIpLimit – Number of maximum simultaneous connection per IP
ForceVhostName – Force vhost hostname in scoreboard. Useful when vhost hostname do not match site visited, for example if you’re using mod_vhost_alias
Step 6. Edit apache2 configuration file
mcedit /etc/apache2/apache2.conf
Add the following:
<IfModule mod_slotlimit.c>
AvailableSlotsPercent 15
MaxConnectionsPerSite 30
LimitSite www.BadSite.xxx
LimitSiteConnections 15
ClientIpLimit 15
ForceVhostName On
</IfModule>
/etc/init.d/apache2 restart
Done