Install mod_cband in linuxapache to limit the bandwidth of virtual hosts

Source: Internet
Author: User
Tags goagent
Mod_cband is an apache2 module that limits user bandwidth, maximum download speed, access request speed per second, and maximum number of concurrent ip access connections. 1. security

Mod_cbandIt is an apache2 module that limits user bandwidth, maximum download speed, access request speed per second, and maximum number of concurrent ip access connections.
1. install mod_cband as follows:

# You can download mod-cband-0.9.7.2 in my online drive: http://pan.baidu.com/s/1bnzjYwB# wget http://codee.pl/download/cband/mod-cband-0.9.7.5.tgz # tar zxvf mod-cband-0.9.7.2.tgz # cd mod-cband-0.9.7.2 #. /configure -- with-apxs =/usr/local/apache/bin/apxs # whereis apxs. you can see your apxs path # make install

2. check whether your apache configuration file httpd. conf is loaded.
LoadModule cband_module       /usr/lib64/httpd/modules/mod_cband.so

3. configure the VM
 
  
ServerAdmin admin@phpddt.comDocumentRoot/var/www/html/goagentServerName goagent. phpddt. comErrorLog/var/log/httpd/goagent/error_logCustomLog/var/log/httpd/goagent/access_log combinedCBandSpeed 1024 100 30 # CBandSpeed limits the total maximum link speed to KB, A maximum of 100 requests and 30 links can be concurrently processed. CBandRemoteSpeed 20kb/s 5 3 # CBandRemoteSpeed limits the maximum link speed of a user to 20kb. a maximum of five requests and three links can be concurrently processed.
 

4. restart apache.
Other parameter settings:

#100 MB virtualhost bandwidth limit
CBandLimit 100 M
The total access bandwidth of the VM is limited to 100 Mb.
# Maximal 1024 kbps speed for this virtualhost
# Maximal 10 requests per second for this virtualhost
# Maximal 30 open connections for this virtualhost
CBandSpeed 1024 10 30

Limit the maximum access speed of this VM to 1024 kbps
Limit the maximum number of requests per second for this VM
Limit the maximum number of concurrent connections to this VM
# Maximal 10kB/s speed, 3 requests/s and 2 open connections for any remote client

CBandRemoteSpeed 10kb/s 3 2
The access speed from the remote end is limited to 10 kb per second, 3 requests per second, and 2 connections.
# A period of time after which the scoreboard will be cleared (4 weeks)
CBandPeriod 4 W
Set how long to reset (reset) the recorded global access bandwidth ).
4 W = 4 weeks 4 weeks (one month)
# Then you can access the status page with a URL like: http: // server_name/cband-status

SetHandler cband-status
 

With the real-time monitoring feature of mod_cband enabled, you can use http: // server_name/cband-status for intuitive observation. (Global Monitoring)

# Then you can access the status page with a URL like: http: // server_name/cband-status-me

SetHandler cband-status-me
 

Related Article

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.