在apache下限制每個(gè)虛擬主機(jī)的并發(fā)數(shù)?。。?!
更新時(shí)間:2006年10月09日 00:00:00 作者:
來自http://www.allabc.com
論壇:http://seecee.dev-c.nl/forumdisplay.php?fid=4
下載模塊:
http://www.nowhere-land.org/prog ... st_limit-0.4.tar.gz
官方網(wǎng)址: http://www.nowhere-land.org/programs/mod_vhost_limit/
安裝:
apxs -c mod_vhost_limit.c -o /path/to/libexec/mod_vhost_limit.so
在 httpd.conf 加入:
LoadModule vhost_limit_module libexec/mod_vhost_limit.so
AddModule mod_vhost_limit.c
配置:
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>
其中: server1 被限制為 100 個(gè)并發(fā)線程數(shù)。 server2 被限制為 30 個(gè)并發(fā)線程數(shù)。 server3 沒有被限制。
注:需 mod_status 的 ExtendedStatus On 支持??!
如超出限制的并發(fā)數(shù)在客戶端就會(huì)出現(xiàn)503錯(cuò)誤:
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
--------------------------------------------------------------------------------
Apache/1.3.27 Server at server1 Port 80
在 error_log 中將會(huì)有類似以下的錯(cuò)誤提示:
[Mon Jun 23 15:22:24 2003] [error] client access to server1 deferred, MaxVhostClients 100 exceeded
希望對(duì)大家有用!! (出處:http://www.allabc.com)
相關(guān)文章
PHP4實(shí)際應(yīng)用經(jīng)驗(yàn)篇(2)
PHP4實(shí)際應(yīng)用經(jīng)驗(yàn)篇(2)...2006-10-10在Windows系統(tǒng)上安裝PHP運(yùn)行環(huán)境文字教程
其實(shí)如果只是為了測試php的運(yùn)行而不是服務(wù)器運(yùn)行,可以用phpnow等,腳本之家都有提供下載。2010-07-07