Logo Background RSS

Install mod_bandwidth

  • What is Mod_Bandwidth

    “Mod_bandwidth” (mod bandwidth) is a module for the Apache webserver that enable the setting of server-wide or per connection bandwidth limits, based on the directory, size of files and remote IP/domain.

    For Apache 1.3x. ONLY! This how-to is not compatible with old versions of apache, including but not limited to 1.3beta

    How to install mod_bandwidth

    1. Login to your server via SSH as root.

    2. Type: mkdir /root/mod_bw

    3. Type: cd /root/mod_bw

    4. Type: wget ftp://ftp.cohprog.com/pub/apache/module/1.3.0/mod_bandwidth.c

    5. Type: /usr/local/apache/bin/apxs -c /root/mod_bw/mod_bandwidth.c -o /usr/local/apache/libexec/mod_bandwidth.so

    6. Type: mkdir /usr/local/apache/bw_limit

    7. Type: mkdir /usr/local/apache/bw_limit/link

    8. Type: mkdir /usr/local/apache/bw_limit/master

    9. Type: pico -w /etc/httpd/conf/httpd.conf

    10. Locate the following Line: LoadModule rewrite_module libexec/mod_rewrite.so

    11. Before the above line add this:
    LoadModule bandwidth_module libexec/mod_bandwidth.so

    12. Now locate this line: AddModule mod_env.c

    13. Before the above line add this:
    AddModule mod_bandwidth.c

    14. Now locate this line: # Document types.

    15. Before the above line add this:
    BandWidthDataDir “/usr/local/apache/bw_limit”
    BandWidthModule On

    16. To enable mod_bandwidth on a virtual host locate the virtual host entry for the specified domain/acount you wish to limit. Just before the line add the following:
    BandWidthModule On
    BandWidth all 512

    The 512 can be replaced with whatever rate you wish to limit the acount too.

    17. Save the file and exit.
    CTRL-X then Y then enter.

    18. Type: service httpd restart

    19. Type: cd /usr/sbin

    20. Type: wget ftp://ftp.cohprog.com/pub/apache/module/cleanlink.pl

    What is cleanlink?
    Cleanlink is a deamon that is used to clean links created by mod_bandwidth when they aren’t removed properly by the server. (When a httpd process doesn’t terminate the usual way.)

    21. Type: chmod 755 cleanlink.pl

    22. Type: pico -w cleanlink.pl

    23. Change $LINKDIR to the following:
    $LINKDIR=”/usr/local/apache/bw_limit/link”;

    24. Save the file and exit.
    CTRL-X then Y then enter.

    25. Type: perl cleanlink.pl

    26. Type: pico -w /etc/rc.d/rc.local

    27. Scroll down to the very end of the file and add the following:
    # The following line Launches CleanLink for Mod_Bandwidth
    perl /usr/sbin/cleanlink.pl

    28. Save the file and exit.
    CTRL-X then Y then enter.

    mod_bandwidth has many options. If you wish to modify mod_bandwidth and enable more options please visit the documentation available by the programmer here: http://www.cohprog.com/v3/bandwidth/doc-en.html

  1. #1 indian classified
    March 26th, 2009 at 11:55 pm

    great Who links to my website?

    Nice tutorial on how to install mod_bandwidth, i was looking for it from a long time thank you

    Post ReplyPost Reply
  2. #2 buy mobile phone
    October 29th, 2009 at 10:05 pm

    Very helpful information, liked it and so Stumbled it to share with my friends,Thanks for the brilliant idea.

    Post ReplyPost Reply
  3. #3 seo
    June 2nd, 2010 at 8:09 am

    The use of mod_bandwidth or mod_throttle on your webserver is handy indeed. Large file uploads will fully saturate your typical 128kbps outgoing bandwidth on your standard DSL or cable modem account, thereby making your browsers requests for downloads get lost in the noise.

    Post ReplyPost Reply
  4. #4 injection molding
    September 3rd, 2011 at 12:30 pm

    You post an informative blog.thanks for sharing this ,I waiting for this for an long time…

    Post ReplyPost Reply
  5. #5 Gp jobs
    October 1st, 2011 at 9:30 am

    what is bandwidth? and what’s the difference between monthly bandwidth and your overall bandwidth?

    Post ReplyPost Reply
  6. #6 professional speaker
    October 1st, 2011 at 10:53 am

    I am constantly deleting my cookies and temporary files while connected to the internet, am I using a lot of bandwidth? Can someone explain bandwidth to me, in kindergarten terms please, I am not that computer savvy!

    Post ReplyPost Reply
  7. #7 vanderbilt beach condominiums
    October 3rd, 2011 at 7:33 pm

    Now this is what you call a detailed step-by-step instruction. Thanks for enumerating the steps. This will surely be of benefit to many.

    Post ReplyPost Reply
  8. #8 injection molding
    December 1st, 2011 at 5:26 pm

    I am not having the much knowledge about Linux operating system but i really enjoyed your post..thanks for sharing the post.

    Post ReplyPost Reply
  9. #9 professional speaker
    December 26th, 2011 at 1:32 pm

    Thank you for sharing an important knowledge with us .

    Post ReplyPost Reply
Leave a Comment