How To Manage Apache Resources Limits With mod_slotlimit (Debian Etch)

Channel: Linux
Abstract: tar zxvf mod_slotlimit.tar.gz cd mod_slotlimit-1.0 make make install Add in the main config file of your web server the following command in order to
How To Manage Apache Resources Limits With mod_slotlimit (Debian Etch)

mod_slotlimit is an Apache module that using dynamic slot allocation algorithm and static rules, can manage resources used for each running site.

 

1. Installation

In order to compile mod_slotlimit, you will need to have apxs2 (APache eXtension tool) installed and configured with Apache.

The follow command will install it:

apt-get install apache2-prefork-dev

Now we download the source package present at http://sourceforge.net/projects/mod-slotlimit/ or download it using wget application and this direct link to the repository:

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.0
make
make install

Add in the main config file of your web server the following command in order to load mod_slotlimit module.

vi /etc/apache2/httpd.conf
[...]
LoadModule slotlimit_module   /usr/lib/apache2/modules/mod_slotlimit.so

 

2. Configuration

Before we are able to write our configuration, we should known what directives are supported by this module.

For more information read mod_slotlimit's 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 we open config file of our web server in order to write the configuration:

vi /etc/apache2/apache2.conf
[...]
<IfModule mod_slotlimit.c>
AvailableSlotsPercent 15
MaxConnectionsPerSite 30
LimitSite www.BadSite.xxx
LimitSiteConnections 15
ClientIpLimit 15
ForceVhostName On
</IfModule>
[...]

Finally we restart Apache:

/etc/init.d/apache2 restart

 

3. Links
  • mod_slotlimit: http://sourceforge.net/projects/mod-slotlimit/
  • Apache: http://httpd.apache.org
  • Debian: http://www.debian.org

Ref From: howtoforge
Channels: debianapache

Related articles