Manage Apache Resources Limits With mod_slotlimit
Posted by Admin on February 6th, 2009
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
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
Now we download the source package from here
wget http://kent.dl.sourceforge.net/sourceforge/mod-slotlimit/mod_slotlimit.tar.gz
Next open archive, compile and install module with those commands:
#tar zxvf mod_slotlimit.tar.gz
#cd mod_slotlimit-1.1
#make
#make install
This will complete the installation
Load Module
Now in the main config file add mod_slotlimit module.
#vi /etc/apache2/httpd.conf
LoadModule slotlimit_module /usr/lib/apache2/modules/mod_slotlimit.so
Configuring mod_slotlimit
Usefule Directives and if you want more check mod_slotlimit documentation
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
Now edit apache2 configuration file
#vi /etc/apache2/apache2.conf
Add the following lines save and exit
<IfModule mod_slotlimit.c>
AvailableSlotsPercent 15
MaxConnectionsPerSite 30
LimitSite www.BadSite.xxx
LimitSiteConnections 15
ClientIpLimit 15
ForceVhostName On
</IfModule>
Now restart Apache server using the following command
#/etc/init.d/apache2 restart

