# Name and URL for publisher data in Metalinks (just for informative purpose) MirrorBrainMetalinkPublisher "Oranges, Inc." http://juice.example.com # Sets a CSS stylesheet to add to mirror lists MirrorBrainMirrorlistStyleSheet "/mirrorbrain.css" # Absolute path to header to be included at the top of the mirror # lists/details page, instead of the built-in header MirrorBrainMirrorlistHeader /srv/www/htdocs/mb-header.html # Absolute path to footer to be appended to the mirror # lists/details pages, instead of the built-in footer MirrorBrainMirrorlistFooter /srv/www/htdocs/mb-footer.html # Set to On to suppress the filename included when hashes are sent. # Normally, they come as "99eaed37390ba0571f8d285829ff63fc foobar", # as in the format well-known from the md5sum/sha1sum tools. # Default: Off MirrorBrainHashesSuppressFilenames Off # Available details for logging with the CustomLog directive: # %{Location}o the full redirection URL # %{X-MirrorBrain-Chose-Mirror}o the mirror identifier # %{MB_FILESIZE}e the size of the file # %{MB_REDIRECTED}e '1' if the request was redirected # %{MB_NOMIRROR}e '1' if no mirror was found # %{MB_CONTINENT_CODE}e the client's continent code # %{MB_COUNTRY_CODE}e the client's country code # Example of a good, detailed access log: LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \ want:%{WANT}e give:%{GIVE}e r:%{MB_REALM}e %{X-MirrorBrain-Mirror}o \ %{MB_CONTINENT_CODE}e:%{MB_COUNTRY_CODE}e ASN:%{ASN}e P:%{PFX}e \ %I %O size:%{MB_FILESIZE}e %{Range}i" combined_redirect # Same example, but also uses mod_logio to log actual sent bytes): LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \ want:%{WANT}e give:%{GIVE}e r:%{MB_REALM}e %{X-MirrorBrain-Mirror}o \ %{MB_CONTINENT_CODE}e:%{MB_COUNTRY_CODE}e ASN:%{ASN}e P:%{PFX}e \ %I %O size:%{MB_FILESIZE}e %{Range}i" combinedio_redirect # Simpler log that just includes where we redirected to, through the the %{Location}o logging variable LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Location}o\"" mirrorbrain CustomLog "|/usr/sbin/rotatelogs2 /var/log/apache2/redirects_%Y-%m-%d-%H 3600 -0" mirrorbrain # Example #1 for conditional logging: # Whenever no mirror is found for a file, mod_mirrorbrain sets the enviroment # variable MB_NOMIRROR. This can be used to write an additional file # logging all unmirrored files, including the bytes we served ourselves: LogFormat "%h %t %U %B \"%{Referer}i\"" nomirror CustomLog /var/log/apache2/unmirrored_log nomirror env=MB_NOMIRROR # Example #2 for conditional logging: # Or, write an extra file logging _only_ redirections. mod_mirrorbrain sets the # environment variable MB_REDIRECTED to 1 whenever it redirects a client. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Location}o\"" redirected CustomLog /var/log/apache2/redirected_log redirected env=MB_REDIRECTED # The SQL query string, should you need to change the compiled in default. # Normally, you shouldn't need to set this. # # Caveat: the fields are accessed by index. Thus, the order here must not change. # # MirrorBrainDBDQuery "\ # SELECT id, identifier, region, country, asn, prefix, score, \ # baseurl, region_only, country_only, as_only, prefix_only, \ # other_countries, file_maxsize \ # FROM server \ # WHERE id::smallint = any( \ # (SELECT mirrors FROM filearr WHERE path = %s)::smallint[] \ # ) \ # AND enabled AND status_baseurl AND score > 0" # the following two directives are only available if mod_mirrorbrain is # compiled with memcache support. Normally, memcache support is not used. # enable / disable memcache usage #MirrorBrainMemcached On # lifetime of objects in memcache daemon #MirrorBrainMemcachedLifetime 600 # create directory listings Options +Indexes # redirector is enabled for this subtree # the directory where this is done matters, because it will be the basedir. MirrorBrainEngine On # enable debug mode -- warning, on a busy server this should be done for subtrees # only, because it creates a lot of output MirrorBrainDebug Off # If FormGET is "On", the module understands optional query arguments # (appended to the URL) for diagnostic or other uses. # Appending the query string with '?' or '.' triggers the same behaviour. # # metadata parameters: # md5 return the MD5 hash of the file # sha1 return the SHA-1 hash of the file # sha256 return the SHA-256 hash of the file # asc return a PGP signature (if existent) # mirrorlist return an XHTML list of all metadata and all mirrors # meta4 return an IETF metalink (RFC5854) # metalink return a v3 metalink # torrent return a torrent # btih return the BitTorrent infohash # magnet return a magnet link # zsync return zsync metadata # # diagnostic parameters: # country=xy pretend that the request comes from this country # (ISO 3166 country code) # as=123 pretend that the request comes from the autonomous # system with this number # newmirror don't stick to memcached mirror, make a new choice # NOTE: newmirror has an effect ONLY when # compiling with memcache support # fakefile pretend that the requested file exists # (useful ONLY for testing) # FormGET On #Set to On to handle HEAD requests locally, instead of redirecting them MirrorBrainHandleHEADRequestLocally Off # Don't redirect for files smaller than 4096 bytes # A redirect would only cost resources (database lookup, mirrorlist generation, # additional roundtrip for the client), but not save anything; it's # cheaper to deliver small content directly. # This doesn't affect requests on a hash of such a file, or a mirror list. MirrorBrainMinSize 4096 # Regexp which determines which files will be excluded from redirecting. # Perfect for signatures -- small files that you rather want to deliver # yourself for security reasons. # # The directive is not additive. Use it once. # # Note, this type of file is typically quite small and would be delivered # directly also when you have MirrorBrainMinSize 4096 configured, for instance. # But even though the files would be covered by that rule, it is better # to make the rule explicit. # # Note, A very similar effect can be achieved with the # MirrorBrainExcludeMimeType directive; or it might be even easier. MirrorBrainExcludeFileMask "\.(md5|sha1|asc)" # User-Agent to always exclude from redirecting (wildcards allowed) MirrorBrainExcludeUserAgent w3m/0.5.1 # Networks or IP addresses to always exclude from redirecting. This # directive is additive and can be repeated. Note that for networks, a # simple string prefix comparison is used to match on them, and not # prefix matching. MirrorBrainExcludeNetwork 192.168. MirrorBrainExcludeNetwork 10.10.10.1 # Mimetype to always exclude from redirecting (wildcards allowed) # The directive is additive and can be repeated. MirrorBrainExcludeMimeType text/xml # If a request is to be redirected to a mirror, but no mirror is found # in the database, MirrorBrain will normally deliver the file itself. # However, those requests can alternatively be sent to a fixed list of # mirrors, if one or more are configured as shown below. # The format is: # Notes: # 1) Those mirrors _must_ have the files, because no checking is done # on them. (The directives can be set per directory to achieve # needed granularity.) # 2) mirrors are prioritized for selection by the clients' country and # region and randomly choosen according to those priorities. MirrorBrainFallback na us http://ultimate-mirrors.com/mirrors/foobar/ MirrorBrainFallback eu de http://www.uptime-king.de/foobar/ MirrorBrainFallback as jp ftp://www.diskgiant.jp/pub/mirrors/foobar # NOTE: This directive is relevant only for old-style (v3) Metalinks. It has # no meaning regarding IETF (RFC5854) metalinks. MirrorBrain can generate # its own torrents meanwhile, and the directive will be phased out # # For files matching the following file mask (regular expression), # check if a file with ending in .torrent does exist, and if yes, add a # link to it into generated metalinks. # This is limited to .iso and .dmg files in this example, because then Apache # doesn't need to do this additional check for each request. MirrorBrainMetalinkTorrentAddMask "\.(iso|dmg)$" # Define the URL a BitTorrent Tracker to be included in Torrents and in # Magnet links. Directive can be repeated to specify multiple URLs. MirrorBrainTorrentTrackerURL "http://bt.mirrorbrain.org:8091/announce" MirrorBrainTorrentTrackerURL "udp://bt.mirrorbrain.org:8091/announce" # Define a DHT node to be included in Torrents links. Directive can be # repeated to specify multiple nodes, and takes two arguments (hostname, port). MirrorBrainDHTNode router.bitcomet.com 554 MirrorBrainDHTNode router.bittorrent.com 6881 Options +Indexes MirrorBrainEngine Off MirrorBrainDebug On # vim: set ft=apache ts=4 sw=4 ai expandtab smarttab: