7d4a42e
<IfDefine HAVE_BW>
7d4a42e
  <IfModule !mod_bw.c>
7d4a42e
    LoadModule bw_module    extramodules/mod_bw.so
7d4a42e
  </IfModule>
7d4a42e
</IfDefine>
7d4a42e
7d4a42e
<IfModule mod_bw.c>
7d4a42e
7d4a42e
# You need to set this to On, for the mod to work.. By default, the mod is
7d4a42e
# disabled, and wont limit anything.
7d4a42e
# 
7d4a42e
# Example :
7d4a42e
#           BandWidthModule On
7d4a42e
# 
7d4a42e
# BandWidthModule [On|Off]
7d4a42e
7d4a42e
BandWidthModule On
7d4a42e
7d4a42e
# When enabled (disabled by default) the log will output lots of data to the
7d4a42e
# error log. This data is for debugging purposes, and is usually not needed.
7d4a42e
# If you are curious, you can enable. Please note, that this will make your
7d4a42e
# logs grow a LOT.
7d4a42e
#    
7d4a42e
# Example :
7d4a42e
#           BandWidthDebug On
7d4a42e
# 
7d4a42e
# BandWidthDebug [On|Off]
7d4a42e
 
7d4a42e
# By default, the mod will catch every request. This was done because it is
7d4a42e
# easier to configure.
7d4a42e
# if you disable it, you will have to add the output filter by hand. This is
7d4a42e
# useful is you want only some request being processed by bw_mod.
7d4a42e
#    
7d4a42e
# Example :
7d4a42e
#           ForceBandWidthModule Off
7d4a42e
#           AddOutputFilterByType BW_MOD text/html text/plain
7d4a42e
# 
7d4a42e
# ForceBandWidthModule [On|Off]
7d4a42e
7d4a42e
# This takes 2 parameters. From is the origin of the connections. It could
7d4a42e
# be a full host, part of a domain, an ip address, a network mask (i.e
7d4a42e
# 192.168.0.0/24 or 192.168.0.0/255.255.255.0) or all.
7d4a42e
# The second parameter indicates the total speed available to the Origin.
7d4a42e
# If speed is 0, there is no limit.
7d4a42e
# 
7d4a42e
# Example :
7d4a42e
#         BandWidth localhost 10240
7d4a42e
#         BandWidth 192.168.218.5 0
7d4a42e
# 
7d4a42e
#         ( Order is relevant. First entries have precedence )
7d4a42e
# 
7d4a42e
# BandWidth [From] [bytes/s]
7d4a42e
7d4a42e
# This takes 2 parameters. From is the origin of the connections. It could
7d4a42e
# be a full host, part of a domain, an ip address, a network mask (i.e
7d4a42e
# 192.168.0.0/24 or 192.168.0.0/255.255.255.0) or all.
7d4a42e
# The second parameter indicates the minimun speed each client will have.
7d4a42e
# What does this mean ? If you have a total of 100kbytes speed, and you put
7d4a42e
# MinBandWidth at 50kbytes, it doesnt matter how many clients you have, all
7d4a42e
# of them will have at minimun 50kbytes of total speed to download.
7d4a42e
# If speed is 0, you will be using the default minimun (256 bytes/s).
7d4a42e
# There is a special value of -1. This value means that each client, will
7d4a42e
# have a top speed determined by the BandWidth directive. See the examples.
7d4a42e
# 
7d4a42e
# Examples :
7d4a42e
#           BandWidth    all 102400
7d4a42e
#           MinBandWidth all 50000
7d4a42e
#  
7d4a42e
#          The example above, will have a top speed of 100kb for the 1°
7d4a42e
#         client. If more clients come, it will be splitted accordingly but
7d4a42e
#         everyone will have at least 50kb (even if you have 50 clients)
7d4a42e
# 
7d4a42e
#           BandWidth    all 50000
7d4a42e
#           MinBandWidth all -1
7d4a42e
# 
7d4a42e
#          This example, makes everyone have 50kb as top speed.
7d4a42e
# 
7d4a42e
# MinBandWidth [From] [bytes/s]
7d4a42e
7d4a42e
# Type, is the last part of a file, or * for all. You can use .tgz to match 
7d4a42e
# only tar-compressed files, .avi to match video files, or * to match all.
7d4a42e
# Minimum Size, is the size (in kbytes) of the file, to be matched. That way
7d4a42e
# you can match huge video files that hog your bandwidth.
7d4a42e
# The last parameter... is obvious. The speed allowed.
7d4a42e
# 
7d4a42e
# Example :
7d4a42e
#          LargeFileLimit .avi 500 10240
7d4a42e
# 
7d4a42e
#          This limits .avi files over (or equal to) 500kb to 10kbytes/s
7d4a42e
# 
7d4a42e
# LargeFileLimit [Type] [Minimum Size] [bytes/s]
7d4a42e
7d4a42e
# Probably you never need to touch this. It defaults to 8192 which is good
7d4a42e
# for almost any speed.
7d4a42e
# It must be a size between 1024 and 131072. A Small packet will cause the
7d4a42e
# top speed to be lower, and the mod using more time splitting. If you use
7d4a42e
# a Size too big, the mod will adjust it to lower speeds.
7d4a42e
# 
7d4a42e
# BandWidthPacket [Size]
7d4a42e
7d4a42e
# This directives is useful to deliver a personalized error code.
7d4a42e
# At default, when maxconnections is reached, the mod will issue a 503 
7d4a42e
# HTTP_SERVICE_UNAVAILABLE code. For some users, it is annoying to have an
7d4a42e
# error message, and dont knowing why. You could use an ErrorDocument to 
7d4a42e
# point error 503 to a page explaining that you are under a heavy load of
7d4a42e
# connections, but sometimes 503 isn't issued by the mod.
7d4a42e
# So, with this directive, you can set the error code to return when
7d4a42e
# maxconnections is reached. You can use any error code between 300 and 599.
7d4a42e
# Please note, that some of the error codes are already used, so before using
7d4a42e
# any number, take a look to a list of the codes (search for http error codes
7d4a42e
# in google). 
7d4a42e
# When testing, i've used the error code 510, which hasn't been defined yet.
7d4a42e
# 
7d4a42e
# And Example, with Personalized Error Page :
7d4a42e
# 
7d4a42e
#   ErrorDocument 510 /errors/maxconexceeded.html
7d4a42e
#   BandWidthError 510
7d4a42e
# 
7d4a42e
# Note : Sometimes, the personalized page didn't appear. I'm not sure, but
7d4a42e
#       in many cases, it got fixed, by making the page size over 1024bytes.
7d4a42e
#        Anyways, if you need help using ErrorDocument, refer to the apache
7d4a42e
#       Documentation.
7d4a42e
# 
7d4a42e
# BandWidthError [Error]
7d4a42e
7d4a42e
# This takes 2 parameters. From is the origin of the connections. It could
7d4a42e
# be a full host, part of a domain, an ip address, a network mask (i.e
7d4a42e
# 192.168.0.0/24 or 192.168.0.0/255.255.255.0) or all.
7d4a42e
# The second parameter, is the max connections allowed from the origin. Any
7d4a42e
# connection over Max, will get a 503 Service Temporarily Unavailable
7d4a42e
# 
7d4a42e
# There is a catch. You NEED to have a BandWidth limit for the same origin.
7d4a42e
# It doesnt need to be a low limit. You can use an unlimited setting.
7d4a42e
# You might wonder why. It's because im using them same memory space of the
7d4a42e
# bandwidth limit, to count the connections, so i can save memory space.
7d4a42e
# If you dont put a BandWidth using the same origin, MaxConnections will be
7d4a42e
# ignored.
7d4a42e
# 
7d4a42e
# Example :
7d4a42e
#           BandWidth all 0
7d4a42e
#           MaxConnection all 20
7d4a42e
# or
7d4a42e
#           BandWidth all 0
7d4a42e
#           BandWidth 192.168.0.0/24 10240
7d4a42e
#           MaxConnection all 20
7d4a42e
#           MaxConnection 192.168.0.0/24 5
7d4a42e
# 
7d4a42e
# 
7d4a42e
# Please, rememeber that every speed, will depend mostly on your connection.
7d4a42e
# You cant get more speed if you dont have it.
7d4a42e
# 
7d4a42e
# Remember also.. if you dont follow the instructions, and get some weird 
7d4a42e
# results, recheck your config before sending me an email.
7d4a42e
# 
7d4a42e
# MaxConnection [From] [Max]
7d4a42e
7d4a42e
# <VirtualHost *>
7d4a42e
#     BandWidthModule On
7d4a42e
#     BandWidth all 16384
7d4a42e
#     LargeFileLimit * 500 4096
7d4a42e
# 	<Directory />
7d4a42e
# 	    LargeFileLimit * 100 1024
7d4a42e
# 	</Directory>
7d4a42e
# </VirtualHost>
7d4a42e
# 
7d4a42e
# This wont limit Directory / to 16384. The Directory wont "inherit" the
7d4a42e
# settings from the vhost if you use some of the mod's directives.
7d4a42e
7d4a42e
</IfModule>
7d4a42e
7d4a42e
# VirtualHost example with bandwidth limitation:
7d4a42e
# For more information, look at bw_mod documentation.
7d4a42e
# In this example, we restrict the bandwidth to 10kb 
7d4a42e
# for the connections coming from localhost.
7d4a42e
# And we set the bandwidth unlimited for any other
7d4a42e
# connections.
7d4a42e
# We set maximum amount of concurrent connections as 40.
7d4a42e
# When the bandwidth is exceeded, the visitors see the 
7d4a42e
# personalized error code no 510. 
7d4a42e
#
7d4a42e
#<VirtualHost *>
7d4a42e
#    ServerAdmin webmaster@dummy-host.example.com
7d4a42e
#    DocumentRoot /www/docs/dummy-host.example.com
7d4a42e
#    ServerName dummy-host.example.com
7d4a42e
#    ErrorLog logs/dummy-host.example.com-error_log
7d4a42e
#    CustomLog logs/dummy-host.example.com-access_log common
7d4a42e
#    <IfModule mod_bw.c>   
7d4a42e
#        BandWidthModule On
7d4a42e
#        BandWidthDebug Off
7d4a42e
#        BandWidth localhost 10240
7d4a42e
#        BandWidth all 0
7d4a42e
#        MaxConnection all 40
7d4a42e
#        BandWidthError 510
7d4a42e
#    </IfModule>
7d4a42e
#</VirtualHost>
7d4a42e