How to limit Apache bandwidth traffic

Source: Internet
Author: User
Keywords nbsp; bandwidth flow www http
Tags access speed activate apache apache2 apt bandwidth bandwidth flow etc

Dapper under the apache2 bandwidth flow limit, first confirm the installation of good apache2, installation Libapache2-mod-cband

Apt Install Libapache2-mod-cband

Activate Cband module

Cd/etc/apache2/mods-enabled
Ln-s/etc/apache2/mods-available/cband.conf cband.conf
Ln-s/etc/apache2/mods-available/cband.load Cband.load

Upgrade Libapache2-mod-cband

Apt Install Apache2-prefork-dev
Cd/tmp
wget cband.linux.pl/download/mod-cband-0.9.7.4.tgz
Tar xzvf mod-cband-0.9.7.4.tgz
CD mod-cband-0.9.7.4
./configure
Make
Make install

Because the Cband module is already loaded by Cband.load, the/etc/apache2/httpd.conf is modified to remove the row that joins Cband_module.

Vim/etc/apache2/httpd.conf

Find

LoadModule cband_module/usr/lib/apache2/modules/mod_cband.so

deleted, and saved. To set up a site:

<virtualhost 1.2.3.4>
ServerName www.example.com
ServerAdmin webmaster@example.com
Documentroot/var/www
Cbandspeed 1024 10 30
Cbandremotespeed 20kb/s 3 3
</VirtualHost>

Cbandspeed limits the total access speed of www.example.com virtual hosts to 1024kbps, maximum 10 requests per second and 30 connections per second. Cbandremotespeed limit the access speed of any individual www.example.com virtual host to 20KB per second, maximum 3 requests per second and 3 connections per second.

Restart Apahe2 to make it configured for:

/etc/init.d/apache2 restart

You can also use the URL:

Http://www.example.com/cband-status
Http://www.example.com/cband-status-me

To see the latest traffic.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.