Limit Bandwidth per Apache Virtual Host [closed]

2019-03-17 01:00发布

问题:

I'm going to launch a 2GB Linode VPS to host a couple of Wordpress CMS sites and one based on Yii framework. I planned on using Apache virtualhosts to assign each site it's own webroot on a user's home directory instead of leaving everything in /var/www

Is it possible to limit the bandiwdth allocated to each Apache virtualhost? I was planning on using Debian Squeeze or CentOS for this box. Not that I envision any of the sites maxing out the 4TB of bandwidth allocated from Linode but it just seems like good practice.

I think using a VPS is the best option as none of the sites are particularly large and the cost of using a PaaS seems a bit much for a few simple CMS sites and a lightweight Yii app.

Also - I know this is subjective and somewhat against the rules here - but is Debian particularly easy to use compared to CentOS for a newbie? Linode have an extensive guide on their Wiki about launching and running a CentOS server but I'm sure there are equally as good guides out there in the wild for Debian?

Thanks in advance for any advice :)

回答1:

There are several modules for Apache to limit the total bandwidth for each website. A well known one is mod_bw. Here are some good tutorials on how to set it up:

  • http://www.gavinwill.me.uk/2012/09/limit-apache-bandwidth-with-mod_bw/
  • http://linuxpoison.blogspot.tw/2012/02/setup-and-configure-bandwidth-limiting.html
  • http://www.pwrusr.com/system-administration/apache-mod_bw-for-virtualhost

Here are the modules that I'm aware of which perform bandwidth limiting:

  • mod_bw
  • mod_bandwidth
  • mod_cband