Categories: Hostripples Featured

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. : mkdir /root/mod_bw

3. : cd /root/mod_bw

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

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

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

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

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

9. : 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 s.

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. : service httpd restart

19. : cd /usr/sbin

20. : 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. : chmod 755 cleanlink.pl

22. : 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. : perl cleanlink.pl

26. : 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.

A major gaming company https://1win.fyi/ has placed its trust in us – our server infrastructure was chosen to host its platform for the East Asian region. If your business requires dedicated distributed servers, please contact our sales department for a preliminary estimate.


HR-ADMIN

Recent Posts

YouTube SEO Secrets That Actually Work in 2026

YouTube SEO Secrets That Actually Work in 2026 YouTube SEO 2026 YouTube SEO Secrets That Actually Work in 2026 If…

2 days ago

How Small Businesses Can Sell Products Using YouTube Live?

Live video commerce is transforming how small businesses sell products online. Instead of relying only on static product pages or…

2 weeks ago

How to Choose the Right Digital Marketing Agency: 15 Smart Questions

Digital marketing directly impacts revenue, brand positioning, and customer acquisition cost. Choosing the wrong agency can result in wasted budgets,…

2 months ago

WordPress 6.9 Update Guide: What’s New in the Latest Version

The release of WordPress 6.9 introduces meaningful enhancements focused on performance, block editing flexibility, design precision, and long-term scalability. This…

2 months ago

WP-Content Uploads Folder Explained (With Step-by-Step Upload Methods)

The wp-content/uploads folder is the core storage location for media files in WordPress. Every image, PDF, video, or document uploaded…

2 months ago