Find the answer to your Linux question:
Results 1 to 6 of 6
Hello Everyone i'm newbie in linux i use my server for file hosting. my os is centos 6.3. Server version: Apache/2.2.23 (Unix) I have two question : 1- how can ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    32

    limit bandwidth in apache (dedicated server)


    Hello Everyone
    i'm newbie in linux
    i use my server for file hosting. my os is centos 6.3.
    Server version: Apache/2.2.23 (Unix)
    I have two question :
    1- how can i limit download speed for one subdomain?
    2- how can i limit download to one download in the same time per ip?(for one subdomain)
    i heard there is module/plugin for that.
    can anyone help me with that?
    Last edited by nimait70; 12-09-2012 at 10:26 AM.

  2. #2
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    Hello,

    The module that can do what you requested is "mod-bw" and you must turn it on like below:

    <VirtualHost *:80>
    ServerName www.123.com
    ServerAlias www.123.com
    DocumentRoot /var/www/123

    # Turn bandwidth limitation on
    BandwidthModule On

    # force limitation on every request
    ForceBandWidthModule On

    # limit to 500kB/s
    Bandwidth all 504800

    # Setup custom error message
    ErrorDocument 510 /errors/maxconexceeded.html
    BandWidthError 510

    </VirtualHost>

    Source: Setup and Configure Bandwidth Limiting Module for Apache2 | Linux Poison

    Cheers,
    Srj

  3. #3
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    And here's a full tutorial on how to install, compile, use and I hope everything you need.

    http://svn.apache.org/repos/asf/http..._bw/mod_bw.txt

    Cheers,

  4. #4
    Just Joined!
    Join Date
    Jul 2012
    Posts
    32
    Quote Originally Posted by srj View Post
    Hello,

    The module that can do what you requested is "mod-bw" and you must turn it on like below:

    <VirtualHost *:80>
    ServerName www.123.com
    ServerAlias www.123.com
    DocumentRoot /var/www/123

    # Turn bandwidth limitation on
    BandwidthModule On

    # force limitation on every request
    ForceBandWidthModule On

    # limit to 500kB/s
    Bandwidth all 504800

    # Setup custom error message
    ErrorDocument 510 /errors/maxconexceeded.html
    BandWidthError 510

    </VirtualHost>

    Source: Setup and Configure Bandwidth Limiting Module for Apache2 | Linux Poison

    Cheers,
    Srj

    Quote Originally Posted by srj View Post
    And here's a full tutorial on how to install, compile, use and I hope everything you need.

    http://svn.apache.org/repos/asf/http..._bw/mod_bw.txt

    Cheers,
    thanks for ur replying but...
    1- i want to install that on centos 6.3 x64,can i?
    2- i'm going to apply these limitation on one sub domain
    how should i place the ServerName & ServerAlias?

  5. #5
    srj
    srj is offline
    Just Joined! srj's Avatar
    Join Date
    Jan 2012
    Location
    Bucharest
    Posts
    86
    Hello,

    You can apply this for any domain or subdomain. Just place the "Bandwith" directives inside the correct block-directives:
    <VirtualHost *:80>
    ServerName www.download_limit_domain.com
    Bandwith ...
    </VirtualHost>

    I think it can be plased inside the "Directory" block-directive as well:

    <Directory "/var/www/limited/">
    Bandwidth ....
    ..
    ..
    </Directory>

    Because the module is not build by Apache, but by a 3rd party developer you will have to download the module (http://bwmod.sourceforge.net/#) and compile it yourself using the instruction from the above link I posted before.

    Be informed that this is not the only option to limit the bandwith to your server, other modules exists as well but from what I know, none from Apache.

    I won't be able to help you with more information right now but if time is on my side, I'll test this myself and reply back.

    Cheers,
    Srj

  6. #6
    Just Joined!
    Join Date
    Jul 2012
    Posts
    32
    can u tell me how can i install that on centos 6.3 64bit?
    step by step
    i'm so newbie in linux

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •