This is the module for Apache Web Server to restrict the number of simultaneous connections per a virtual host. Since monopoly by one virtual host is avoidable, it will improve your serviceability.
Presuming you are using apache 1.3.x, adding in a third-party module is fairly straightforward.
# apxs -c mod_vhost_limit.c -o /usr/libexec/mod_vhost_limit.so or # tar -xf apache_<version>.tar.gz # tar -xf mod_vhost_limit.tar.gz # cd apache_<version> # ./configure --add-module=../mod_vhost_limit.c --enable-shared=vhost_limit ... # make # cp src/modules/extra/mod_vhost_limit.so /usr/libexec/mod_vhost_limit.so And then, write in your httpd.conf: LoadModule vhost_limit_module libexec/mod_vhost_limit.so AddModule mod_vhost_limit.c
Syntax: MaxVhostClients number
Context: virtual conf
Override: None
Status: Third Party
Module: mod_vhost_limit
Compatibility: Apache 1.3.5 and above.
The MaxVhostClients directive affects how many connections can be allowed to use simultaneously per a virtual host. It can be written each virtual host context.
Example:
MaxClients 150
ExtendedStatus On
NameVirtualHost *
<VirtualHost *>
ServerName server1
DocumentRoot /some/where/1
MaxVhostClients 100
</VirtualHost>
<VirtualHost *>
ServerName server2
DocumentRoot /some/where/2
MaxVhostClients 30
</VirtualHost>
<VirtualHost *>
ServerName server3
DocumentRoot /some/where/3
</VirtualHost>
In this case, server1 will be limited with 100 connections, server2, 30 connections.
server3 will not be limited (just limited by MaxClients).
If the request is coming over the limit, httpd will only send back a 503 (Temporary Unavailable) message.
Note:
You have to write the 'ServerName' before the 'MaxVhostClients' and set 'ExtendedStatus' on to be available.
Takato Satsuma
$Author: takato $
$Date: 2003/02/26 16:02:40 $
$Id: index.html,v 1.7 2003/02/26 16:02:40 takato Exp $