For some reason, the build didn't work for me as per the instructions on the author's website. With a little pushing & pulling, the following worked for me...
Instructions:
- Download the file 'mod_bandwidth.c' to your desktop. This is freely available from the download page on the author's site.
- Open a terminal type cd Desktop
- Type su & give it your password when asked
- Type this, with no line breaks, replacing 'mrwalker' with your username: gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe -DHARD_SERVER_LIMIT=2048 -DEAPI -DSHARED_MODULE -I/usr/include/httpd -c /Users/mrwalker/Desktop/mod_bandwidth.c
- Type this: cc -bundle -undefined suppress -flat_namespace -Wl,-bind_at_load -o /usr/libexec/httpd/mod_bandwidth.so mod_bandwidth.o
- You should now have a file /usr/libexec/httpd/mod_bandwidth.so. Confirm by typing cd /usr/libexec/httpd, then ls -l. Make it world executable with chmod +x mod_bandwidth.so
- Add the following lines to /etc/httpd/httpd.conf by typing pico /etc/httpd/httpd.conf. Below all the other LoadModule lines, add LoadModule bandwidth_module /usr/libexec/httpd/mod_bandwidth.so. Below all the other AddModule lines, type AddModule mod_bandwidth.c. In the global configuration (or virtual host container if you're using them) add the lines BandWidthModule On and BandWidth all 1024. This will limit the total number of connections to 1024 bytes per second. Change the 1024 as appropriate.
See the documentation for more config options. I advise adding something like LargeFileLimit 8196 0, which will ignore the limit for files below 8k.
- Type Ctrl-o to save the file & Ctrl-x to exit the pico editor.
- Add the required temp directories:
mkdir /tmp/apachebw
mkdir /tmp/apachebw/link
mkdir /tmp/apachebw/master
chmod -R 777 /tmp/apachebw - Restart apache with apachectl restart
[Editor's note: And if I typed everything right while reformatting ... please let me know if you have any troubles with this, as I haven't had time to test it yet.]

