阳升PHP工作室

  1. 当前位置: 主页 > 技术文章 > php技术 >

apache bandwidth limit 限制下载带宽

时间:2018-05-23 11:00来源: 作者: 点击:


本文摘要

apache bandwidth limit 限制下载带宽

 >   > 

apt-cache search apache | grep band
libapache2-mod-bw – bandwidth limiting module for apache2

apt-cache search libapache2 //看看apache2 都有些什么可用的模块

sudo apt-get install libapache2-mod-bw

/etc/apache2/mods-available$ cat bw.load
LoadModule bw_module /usr/lib/apache2/modules/mod_bw.so

/etc/apache2/mods-enabled$ sudo ln -s ../mods-available/bw.load bw.load

<Virtualhost *>
BandWidthModule On
ForceBandWidthModule On //catch each request
BandWidth all 10240 //total bw 10K
MaxConnection all 3 //max connect 3
LargeFileLimit * 1024 1024 //file size > 1024K limited to 1K
<Virtualhost *>

sudo /etc/init.d/apache2 reload

mod_bw完整配置文档
http://legacy.ivn.cl/files/txt/mod_bw-0.8.txt

http://modules.apache.org/

 

This example, makes everyone have 50kb as top speed.

       BandWidth    all 50000       MinBandWidth all -1

Limit every user to a max of 100Kb/s on a vhost :

<Virtualhost *>

  BandwidthModule On

  ForceBandWidthModule On

  Bandwidth all 102400

  MinBandwidth all -1

  Servername www.example.com

</Virtualhost>

 

Mine:

<Virtualhost *>

  BandwidthModule On

  ForceBandWidthModule On

  Bandwidth all 307200

  MinBandwidth all -1

  MaxConnection all 50

  Servername www.example.com

</Virtualhost>





  

更多相关内容

bandwidth(2)限制下载(2)apache(66)limit(46)