afterburner man page

[NAME] [SYNOPSIS] [DESCRIPTION] [OPTIONS] [CONFIG-FILE] [CGI] [MULTIHOMING] [REFTAB]


afterburner(1)                                     afterburner(1)

NAME

afterburner - stripped-down ultra-fast web server

SYNOPSIS

afterburner [-C config-file] [-p port] [-d data-dir] [-u user] [-c cgi-pattern] [-w workers] [-h host] [-l] [-v] [-i pid-file] [-m mime-file] [-r reftab] [-V]

DESCRIPTION

Afterburner is a web server specialized for delivering static files as fast as possible. It is two to ten times faster than other servers on the same hardware. It's fast enough that you don't need to use an accelerator proxy.

Afterburner implements the basic web server features:

One thing you need to be aware of when setting up Afterburner is that it caches files internally. If you change a file on the disk, the change may not be noticed by Afterburner for up to a minute.

OPTIONS

-C
Specifies a config file to read. All options can be set either by command-line flags or in the config file. See below for details.
-p
Specifies an alternate port number to listen on. The default is 80. The config-file option name for this flag is "port".
-d
Specifies the directory to serve. The default is "data". The config-file option name for this flag is "data-dir".
-u
Specifies what user to switch to after initialization when started as root. The default is "nobody". The config-file option name for this flag is "user".
-c
Specifies a wildcard pattern for CGI programs to match. See below for details. By default, CGI is disabled. The config-file option name for this flag is "cgi-pattern".
-w
Specifies the number of worker processes to start. The default is 1. If more are needed later, they are started automatically. The config-file option name for this flag is "workers".
-h
Specifies a hostname to bind to, for multihoming. See below for details. The default is to bind to all hostnames supported on the local machine. The config-file option name for this flag is "hostname".
-l
Pre-loads all files into memory at startup time. If you have enough memory to fit the entire data set, this flag will ensure you run at maximum speed right from the start, instead of reading in each file the first time it is accessed. If on the other hand you don't have enough memory, this flag will just be a waste of time. The config-file option name for this flag is "load-files".
-v
Virtual-hosting flag. If set, then Afterburner will prepend the host name or address to all filenames it receives. The first-level data directory should just contain hostname subdirectories, with the actual files the next level down. See below for details. The config-file option name for this flag is "vhost".
-i
Specifies a file to write the process-id to. If no file is specified, no process-id is written. The config-file option name for this flag is "pid-file".
-m
Reads in a file of MIME types to search in addition to the default ones. The file should contain lines of ".ext type", for example:

.mp7  audio/mpeg7
The config-file option name for this flag is "mime-file".
-r
Reads in a file of referer restrictions. See below for details. The default is no referer restrictions. The config-file option name for this flag is "reftab".
-V
Displays version and license info, then exits.

CONFIG-FILE

All the command-line options can also be set in a config file. One advantage of using a config file is that the file can be changed, and Afterburner will pick up the changes with a re-initialization (HUP signal).

The syntax of the config file is simple, a series of "option" or "option=value" separated by whitespace. The option names are listed above with their corresponding command-line flags.

CGI

Afterburner supports the CGI 1.1 spec.

In order for a CGI program to be run, its name must match the pattern you specify with the -c flag Wildcard patterns may use "*" meaning any string not including a slash "**" meaning any string including slashes, or "?" meaning any single character. They may also contain "|" which separates multiple patterns. For instance, "**.cgi|cgi-bin/*" would allow either any file ending with ".cgi", or any file in the directory "cgi-bin". The pattern gets checked against the filename part of the incoming URL. Don't forget to quote any wildcard characters so that the shell doesn't mess with them.

MULTIHOMING

Multihoming means using one machine to serve multiple hostnames. For instance, if you're an internet provider and you want to let all of your customers have customized web addresses, you might have www.joe.acme.com, www.jane.acme.com, and your own www.acme.com, all running on the same physical hardware. This feature is also known as "virtual hosts". There are three steps to setting this up.

One, make DNS entries for all of the hostnames. The current way to do this, allowed by HTTP/1.1, is to use CNAME aliases, like so:


www.acme.com IN A 192.100.66.1
www.joe.acme.com IN CNAME www.acme.com
www.jane.acme.com IN CNAME www.acme.com
However, this is incompatible with older HTTP/1.0 browsers. If you want to stay compatible, there's a different way - use A records instead, each with a different IP address, like so:

www.acme.com IN A 192.100.66.1
www.joe.acme.com IN A 192.100.66.200
www.jane.acme.com IN A 192.100.66.201
This is bad because it uses extra IP addresses, a somewhat scarce resource. But if you want people with older browsers to be able to visit your sites, you still have to do it this way.

Step two. If you're using the modern CNAME method of multihoming, then you can skip this step. Otherwise, using the older multiple-IP-address method you must set up IP aliases or multiple interfaces for the extra addresses. You can use ifconfig(8)'s alias command to tell the machine to answer to all of the different IP addresses. Example:


ifconfig le0 www.acme.com
ifconfig le0 www.joe.acme.com alias
ifconfig le0 www.jane.acme.com alias
If your OS's version of ifconfig doesn't have an alias command, you're probably out of luck.

Third and last, you must set up Afterburner to handle the multiple hosts. The easiest way is with the -v flag. This works with either CNAME multihosting or multiple-IP multihosting. What it does is send each incoming request to a subdirectory based on the hostname it's intended for. All you have to do in order to set things up is to create those subdirectories in Afterburner's data directory. With the example above, you'd do like so:


mkdir www.acme.com www.joe.acme.com www.jane.acme.com
If you're using old-style multiple-IP multihosting, you should also create symbolic links from the numeric addresses to the names, like so:

ln -s www.acme.com 192.100.66.1
ln -s www.joe.acme.com 192.100.66.200
ln -s www.jane.acme.com 192.100.66.201
This lets the older HTTP/1.0 browsers find the right subdirectory.

There's an optional alternate step three if you're using multiple-IP multihosting: run a separate Afterburner process for each hostname, using the -h flag to specify which one is which. This gives you more flexibility, since you can run each of these processes in separate directories or with different options. Example:


afterburner -h www.acme.com -d /usr/www
afterburner -u joe -h www.joe.acme.com -d /usr/www/joe
afterburner -u jane -h www.jane.acme.com -d /usr/www/jane
But remember, this multiple-process method does not work with CNAME multihosting - for that, you must use a single Afterburner process with the -v flag.

REFTAB

Afterburner includes a somewhat unusual feature, the reftab. This lets you restrict certain files so they may only be fetched when the proper referer is supplied. Referers are sent by the web browser, they show what page is referencing the file. If you wanted to keep other sites from "stealing your bandwidth" by using images from your site in their .html pages, you could set up a reftab to do that.

The reftab file should contain lines of "filename referer", for example:


images/anvil.jpg  http://www.acme.com/anvil.html
That would make it so that images/anvil.jpg could only be fetched via the page http://www.acme.com/anvil.html. Attempts to fetch it through any other page will result in a "403 Forbidden" error.

Both the filenames and the referers may be wildcard patterns. As with CGI, wildcard patterns may use "*" meaning any string not including a slash, "**" meaning any string including slashes, or "?" meaning any single character. They may also contain "|" which separates multiple patterns. This lets you set up some very powerful referer restrictions with a single line, for example:


**.gif|**.jpg  http://www.acme.com/**|http://www.otheracme.com/**
This says that all GIF and JPEG files must have a referer, and the referer may be any URL on either www.acme.com or www.otheracme.com. So the images may be referenced from anywhere on those two sites, and nowhere else.

If no reftab file is present, then there are no referer restrictions, and any page anywhere on the web is allowed to link to your files. If a file matches more than one line in the reftab, only the first one is used.


Back to the Afterburner page.

ACME Labs Webmaster <webmaster@acme.com>