How to limit connection speed

I've never used this module but the documentation seems fairly straight forward.

The directives are valid inside a <VirtualHost> block and will only apply to that virtual host if so. It also looks like they don't inherit from higher parts of the config so you should put every relevant directive in the virtual host.

Your current config sets the bandwidth limit to "0" which means no limit. You want 200KB (I presume you meant kilobytes and not kilobits).

Put this in the virtual host you want to limit:

BandwidthModule On
ForceBandWidthModule On
Bandwidth all 204800

The default MinBandwidth is 256 bytes/s so you can handle 800 simultaneous users before any of them will start getting error messages. If you think 256 bytes/s is a bit low, you can also add MinBandwidth all 1024 which will mean that when you have more than 200 simultaneous requests the 201st will get an error message instead of the page they requested and all of the 200 before that will be guaranteed at least 1KB/s.

I don't usually bother with those <IfModule> blocks because all they do is hide your mistakes and make you think mod_bw is working when it hasn't even loaded.


I figured this out using LargeFileLimit:

<IfModule mod_bw.c>
BandwidthModule On
ForceBandWidthModule On
Bandwidth all "52428800"
MaxConnection all "400"
LargeFileLimit * 1024 204800
BandWidthError 510
</IfModule>

This will mean that the domain is limited to 50mb bandwidth (52428800), that it can only have 400 connections at once and that any files over 1mb will be limited to 200kb/s (204800).

For anyone reading this later you can also put an extension instead of * to limit just zips,rars,avis or whatever.