标题: Module mod_vhost_limit
bmbx
元帅
Rank: 1
半梦半醒


论坛元老勋章 论坛财神勋章 论坛之星奖章 大可
UID 22
精华 50
积分 40573
帖子 22277
威望 48750
金币 19389
热心 629
阅读权限 100
注册 2005-7-31
状态 离线
Module mod_vhost_limit

出处 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

网友 bmbx 签名 - 网友社区 顶 是一种美德
顶部
[广告] 免费域名(Free Subdomain) 免费空间(Free hosting) PR查询(Google Pagerank)



当前时区 GMT+8, 现在时间是 2008-10-7 20:12
信产部ICP备案:京ICP备05066424号 北京市公安局网监备案:1101050648号

Powered by Discuz! 5.5.0
清除 Cookies - 联系我们 - 网友俱乐部 - Archiver - WAP