<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    不可不說(shuō)
    隨心所欲,無(wú)往不利!
    posts - 88,  comments - 92,  trackbacks - 0
    限制并發(fā)數(shù)
    下載模塊:

    到官方網(wǎng)址: http://www.nowhere-land.org/programs/mod_vhost_limit/下載模塊

    http://www.nowhere-land.org/prog ... st_limit-0.4.tar.gz

    安裝
    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 * />
        ServerName       server2
        DocumentRoot     /some/where/2
        MaxVhostClients  30


    <VIRTUALHOST * />
        ServerName       server3
        DocumentRoot     /some/where/3


    其中: server1 被限制為 100 個(gè)并發(fā)線程數(shù)。 server2 被限制為 30 個(gè)并發(fā)線程數(shù)。 server3 沒有被限制。

    注:需 mod_status 的 ExtendedStatus On 支持!!

    如超出限制的并發(fā)數(shù)在客戶端就會(huì)出現(xiàn)503錯(cuò)誤

    ----------------------------------------------------------------------------------------------

    限制IP連接數(shù)

    到這里下載模塊 http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz

    安裝:
    tar zxvf mod_limitipconn-0.04.tar.gz
    cd mod_limitipconn-0.04
    make APXS=/usr/local/apache/bin/apxs  ß-----這里要按你自己的路徑設(shè)置
    make install APXS=/usr/local/apache/bin/apxs ß-----這里要按你自己的路徑設(shè)置

    編輯httpd.conf
    添加
    全局變量:
    < IfModule mod_limitipconn.c >
          < Location / >   # 所有虛擬主機(jī)的/目錄
              MaxConnPerIP 3     # 每IP只允許3個(gè)并發(fā)連接
            NoIPLimit image/*  # 對(duì)圖片不做IP限制
        < /Location >

    < Location /mp3 >  # 所有主機(jī)的/mp3目錄
    MaxConnPerIP 1         # 每IP只允許一個(gè)連接請(qǐng)求   
    OnlyIPLimit audio/mpeg video    # 該限制只對(duì)視頻和音頻格式的文件
        < /Location >
    < /IfModule >



    或者虛擬主機(jī)的:
    < VirtualHost xx.xxx.xx.xx > ##ip 地址
    ServerAdmin easy@phpv.net
    DocumentRoot /home/easy
    ServerName www.phpv.net
    < IfModule mod_limitipconn.c >
        < Location / >   
    MaxConnPerIP 5        
              NoIPLimit image/*      
        < /Location >
          < Location /mp3 >    # 所有主機(jī)的/mp3目錄
    MaxConnPerIP 2         # 每IP只允許一個(gè)連接請(qǐng)求   
    OnlyIPLimit audio/mpeg video # 該限制只對(duì)視頻和音頻格式的文件
          < /Location >
    < /IfModule >
    < /VirtualHost >



    ----------------------------------------------------------------------------------------------

    限制帶寬

    下載模塊 ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c
    安裝:
    /usr/local/apache/bin/apxs -c ./mod_bandwidth.c -o /usr/local/apache/libexec/mod_bandwidth.so  



    <-------以上/usr/local/apache請(qǐng)?jiān)O(shè)置為你的路徑

    編輯httpd.conf
    添加:
    LoadModule bandwidth_module libexec/mod_bandwidth.so
    AddModule mod_bandwidth.c

    重啟你的apache

    相關(guān)文檔

    Global configuration directives :

        * BandWidthDataDir
          Syntax : BandWidthDataDir <directory>
          Default : "/tmp/apachebw"
          Context : server config

    Sets the name of the root directory used by mod_bandwidth to store its internal temporary information. Don't forget to create the needed directories : <directory>/master and <directory>/link

        * BandWidthModule
          Syntax : BandWidthModule <On|Off>
          Default : Off
          Context : per server config

    Enable or disable totaly the whole module. By default, the module is disable so it is safe to compile it in the server anyway.

    PLEASE, NOTE THAT IF YOU SET A BANDWIDTH LIMIT INSIDE A VIRTUALHOST BLOCK, YOU ALSO __NEED__ TO PUT THE "BandWidthModule On" DIRECTIVE INSIDE THAT VIRTUALHOST BLOCK !

    IF YOU SET BANDWIDTH LIMITS INSIDE DIRECTORY BLOCKS (OUTSIDE OF ANY VIRTUALHOST BLOCK), YOU ONLY NEED TO PUT THE "BandWidthModule On" DIRECTIVE ONCE, OUTSIDE OF ANY VIRTUALHOST OR DIRECTORY BLOCK.

        * BandWidthPulse
          Syntax : BandWidthPulse <microseconds>
          Default :
          Context : per server config

    Change the algorithm used to calculate bandwidth and transmit data. In normal mode (old mode), the module try to transmit data in packets of 1KB. That mean that if the bandwidth available is of 512B, the module will transmit 1KB, wait 2 seconds, transmit another 1KB and so one.

    Seting a value with "BandWidthPulse", will change the algorithm so that the server will always wait the same amount of time between sending packets but the size of the packets will change. The value is in microseconds. For example, if you set "BandWidthPulse 1000000" (1 sec) and the bandwidth available is of 512B, the sever will transmit 512B, wait 1 second, transmit 512B and so on.

    The advantage is a smother flow of data. The disadvantage is a bigger overhead of data transmited for packet header. Setting too small a value (bellow 1/5 of a sec) is not realy useful and will put more load on the system and generate more traffic for packet header.

    Note also that the operating system may do some buffering on it's own and so defeat the purpose of setting small values.

    This may be very useful on especialy crowded network connection : In normal mode, several seconds may happen between the sending of a full packet. This may lead to timeout or people may believe that the connection is hanging. Seting a value of 1000000 (1 sec) would guarantee that some data are sent every seconds...
    posted on 2008-09-16 10:56 藍(lán)劍 閱讀(851) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     


    <2025年7月>
    293012345
    6789101112
    13141516171819
    20212223242526
    272829303112
    3456789

    常用鏈接

    留言簿(6)

    隨筆分類(62)

    隨筆檔案(90)

    文章檔案(9)

    相冊(cè)

    友情鏈接

    搜索

    •  

    積分與排名

    • 積分 - 326085
    • 排名 - 172

    最新評(píng)論

    閱讀排行榜

    評(píng)論排行榜

    主站蜘蛛池模板: 亚洲人成电影青青在线播放| 国产精品亚洲片在线花蝴蝶| 两个人看的www视频免费完整版| a毛片久久免费观看| 国产免费一区二区三区在线观看| 丁香花免费完整高清观看| 亚洲综合激情视频| 无遮挡国产高潮视频免费观看| 日本免费人成视频播放| 亚洲高清国产拍精品26U| a级毛片在线免费观看| 亚洲国产综合精品中文第一区| 一个人免费日韩不卡视频| 精品亚洲A∨无码一区二区三区| 男人扒开添女人下部免费视频| 免费v片视频在线观看视频| 亚洲成在人线电影天堂色| 99热在线日韩精品免费| 色播亚洲视频在线观看| 成年女人视频网站免费m| 亚洲国产综合专区在线电影| 日本视频一区在线观看免费| 亚洲老妈激情一区二区三区| 亚洲成AV人片在WWW| 久久综合给合久久国产免费 | 亚洲国产成人91精品| 97在线线免费观看视频在线观看| 亚洲欧美日韩自偷自拍| 亚洲伊人久久综合中文成人网| 亚洲毛片基地4455ww| 亚洲国产成人a精品不卡在线| 国产成人免费AV在线播放| 亚洲伊人色一综合网| 亚洲精品A在线观看| 最刺激黄a大片免费网站| 亚洲AV无码专区国产乱码不卡| 久久午夜夜伦鲁鲁片免费无码影视 | 久久久久免费看成人影片| 亚洲中文字幕久久久一区| 亚洲中文字幕无码专区 | 成年女人免费视频播放体验区|