出处 http://www.nowhere-land.org/programs/mod_vhost_limit/
Module mod_vhost_limit
--------------------------------------------------------------------------------
Summary
This is the module for Apache Web Server to restrict the number of simultaneous connections per a virtual host.
Download
mod_vhost_limit-0.3.tar.gz Update
http://www.nowhere-land.org/prog ... st_limit-0.3.tar.gz
History
2002.02.05
Initial revision 0.1
2002.11.19
version 0.2.
* 'MaxConnPerVhost' directive was obsoleted.
By using 'MaxVhostClients', it's able to control connections
per a virtual context.
2003.02.27
Version 0.3.
* Run as the post-read-request module. [Takato]
* Returns an error if ExtendedStatus is not set to On.
* Takes into account state SERVER_BUSY_LOG and SERVER_BUSY_DNS.
* Better accounts the current vhost connections.
* Changed comparison done on vhost names to a raw comparison of
pointers on server_rec.
contributed by Mathias Herberts <Mathias.Herberts@iroise.net>
Compiling mod_vhost_limit into Apache
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
Directives
MaxVhostClients
--------------------------------------------------------------------------------
MaxVhostClients directive
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.
e.g.
Keep on overloading against the target virtual host, and change the value for MaxVhostClients.
generated by RRDTOOL.
1. without MaxVhostClients (just limited by MaxClients 150)
2. with MaxVhostClients 50
3. with MaxVhostClients 100
--------------------------------------------------------------------------------
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 $
--------------------------------------------------------------------------------
Apache HTTP Server Version 1.3 |