Welcome to the documentation for Boa, a high performance
HTTP Server for UN*X-alike computers, covered by the
GNU General Public License.
The on-line, updated copy of this documentation lives at
Copyright © 1996-2003 Jon Nelson and Larry Doolittle
Last Updated: 10 Jan 2003, $Revision: 22.214.171.124 $
-- Detailed Node Listing --
Limits and Design Philosophy
Boa is a single-tasking HTTP server. That means that unlike traditional web servers, it does not fork for each incoming connection, nor does it fork many copies of itself to handle multiple connections. It internally multiplexes all of the ongoing HTTP connections, and forks only for CGI programs (which must be separate processes), automatic directory generation, and automatic file gunzipping. Preliminary tests show Boa is capable of handling several thousand hits per second on a 300 MHz Pentium and dozens of hits per second on a lowly 20 MHz 386/SX.
The primary design goals of Boa are speed and security. Security, in the sense of can't be subverted by a malicious user, not fine grained access control and encrypted communications. Boa is not intended as a feature-packed server; if you want one of those, check out WN (http://hopf.math.nwu.edu/) from John Franks. Modifications to Boa that improve its speed, security, robustness, and portability, are eagerly sought. Other features may be added if they can be achieved without hurting the primary goals.
Boa was created in 1991 by Paul Phillips (firstname.lastname@example.org). It is now being maintained and enhanced by Larry Doolittle (email@example.com) and Jon Nelson (firstname.lastname@example.org). Please see the acknowledgment section for further details.
GNU/Linux is the development platform at the moment, other OS's are known to work. If you'd like to contribute to this effort, contact Larry or Jon via e-mail.
Boa is currently being developed and tested on GNU/Linux/i386. The code is straightforward (more so than most other servers), so it should run easily on most modern Unix-alike platforms. Recent versions of Boa worked fine on FreeBSD, SunOS 4.1.4, GNU/Linux-SPARC, and HP-UX 9.0. Pre-1.2.0 GNU/Linux kernels may not work because of deficient mmap() implementations.
Example: ./boa -c /usr/local/boa
defines.hcan be overridden on the commandline using the
-coption. The server root must hold your local copy of the configuration file
Example: /usr/sbin/boa -c /etc/boa
The Boa configuration file is parsed with a custom parser. If it reports an error, the line number will be provided; it should be easy to spot. The syntax of each of these rules is very simple, and they can occur in any order. Where possible, these directives mimic those of NCSA httpd 1.3; I (Paul Phillips) saw no reason to introduce gratuitous differences.
Note: the "ServerRoot" is not in this configuration file. It can be
compiled into the server (see
defines.h) or specified on the command
line with the
The following directives are contained in the
boa.conf file, and most,
but not all, are required.
The name you provide gets run through inet_aton(3), so you have to use dotted quad notation. This configuration is too important to trust some DNS.
You only get one "Listen" directive, if you want service on multiple IP addresses, you have three choices:
User <username or UID>
Group <groupname or GID>
ServerAdmin <email address>
Hostnames must start with a letter, end with a letter or digit,
and have as interior characters only letters, digits, and hyphen.
Hostnames must not exceed 63 characters in length.
DirectoryMaker <full pathname to program>
DefaultType <mime type>
DefaultCharset <default charset>
AddType <mime type> <extension> extension...
Redirect, Alias, and ScriptAlias
Redirect <path1> <path2>
Alias <path1> <path2>
ScriptAlias <path1> <path2>
Boa has been designed to use the existing file system security. In
boa.conf, the directives user and
group determine who Boa will run as, if launched by root.
By default, the user/group is nobody/nogroup. This allows quite a bit
of flexibility. For example, if you want to disallow access to otherwise
accessible directories or files, simply make them inaccessible to
nobody/nogroup. If the user that Boa runs as is "boa" and the groups that
"boa" belongs to include "web-stuff" then files/directories accessible
by users with group "web-stuff" will also be accessible to Boa.
The February 2000 hoo-rah from CERT advisory CA-2000-02 has little to do with Boa. As of version 0.94.4, Boa's escaping rules have been cleaned up a little, but they weren't that bad before. The example CGI programs have been updated to show what effort is needed there. If you write, maintain, or use CGI programs under Boa (or any other server) it's worth your while to read and understand this advisory. The real problem, however, boils down to browser and web page designers emphasizing frills over content and security. The market leading browsers assume (incorrectly) that all web pages are trustworthy.
There are many issues that become more difficult to resolve in a single tasking web server than in the normal forking model. Here is a partial list - there are probably others that haven't been encountered yet.
The file systems being served should be much faster than the network connection to the HTTP requests, or performance will suffer. For instance, if a document is served from a CD-ROM, the whole server (including all other currently incomplete data transfers) will stall while the CD-ROM spins up. This is a consequence of the fact that Boa mmap()'s each file being served, and lets the kernel read and cache pages as best it knows how. When the files come from a local disk (the faster the better), this is no problem, and in fact delivers nearly ideal performance under heavy load. Avoid serving documents from NFS and CD-ROM unless you have even slower inbound net connections (e.g., POTS SLIP).
Writing a nonblocking gethostbyaddr is a difficult and not very
enjoyable task. Paul Phillips experimented with several methods,
including a separate logging process, before removing hostname
lookups entirely. There is a companion program with Boa
util/resolver.pl that will postprocess the logfiles and
replace IP addresses with hostnames, which is much faster no matter
what sort of server you run.
Same difficulties as hostname lookups; not included. Boa provides a REMOTE_PORT environment variable, in addition to REMOTE_ADDR, so that a CGI program can do its own ident. See the end of examples/cgi-test.cgi.
If users are allowed to serve HTML from their home directories, password file lookups can potentially block the process. To lessen the impact, each user's home directory is cached by Boa so it need only be looked up once.
Since a file descriptor is needed for every ongoing connection (two for non-nph CGIs, directories, and automatic gunzipping of files), it is possible though highly improbable to run out of file descriptors. The symptoms of this conditions may vary with your particular unix variant, but you will probably see log entries giving an error message for accept. Try to build your kernel to give an adequate number for your usage - GNU/Linux provides 256 out of the box, more than enough for most people.
In the pursuit of speed and simplicity, some aspects of Boa differ from the popular web servers. In no particular order:
The REMOTE_HOST environment variable is not set for CGI programs, for reasons already described. This is easily worked around because the IP address is provided in the REMOTE_ADDR variable, so (if the CGI program actually cares) gethostbyaddr or a variant can be used.
We don't like them, and they are too slow to parse. We will consider more efficient alternatives.
Boa will follow symbolic links, and serve any file that it can read. The expectation is that you will configure Boa to run as user "nobody", and only files configured world readable will come out. If Boa is compiled with -enable-access-control, access control is supported using the Allow, Deny directives.
There is no option to run chrooted. If anybody wants this, and is willing to try out experimental code, contact the maintainers.
Like any good server, Boa traps SIGHUP and rereads
However, under normal circumstances, it has already given away
permissions, so many items listed in
boa.conf can not take effect.
No attempt is made to change uid, gid, log files, or server port.
All other configuration changes should take place smoothly.
Not all browsers handle relative URLs correctly. Boa will not cover up for this browser bug, and will typically report 404 Not Found for URL's containing odd combinations of "../" 's.
Note: As of version 0.95.0 (unreleased) the URL parser has been rewritten and *does* correctly handle relative URLs.
This program is distributed under the
GNU General Public License.
as noted in each source file:
/* * Boa, an http server * Copyright (C) 1995 Paul Phillips <email@example.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */
Paul Phillips wrote the first versions of Boa, up to and including version 0.91. Version 0.92 of Boa was officially released December 1996 by Larry Doolittle. Version 0.93 was the development version of 0.94, which was released in February 2000.
The Boa Webserver is currently (Feb 2000) maintained and enhanced by Larry Doolittle (firstname.lastname@example.org) and Jon Nelson (email@example.com).
We would like to thank Russ Nelson (firstname.lastname@example.org) for hosting the web site.
We would also like to thank Paul Philips for writing code that is worth maintaining and supporting.
Many people have contributed to Boa, but instead of listing them
here, their names and specific contributions have been listed
Paul Philips records his acknowledgments as follows:
Thanks to everyone in the WWW community, in general a great bunch of people. Special thanks to Clem Taylor (<email@example.com>), who provided invaluable feedback on many of my ideas, and offered good ones of his own. Also thanks to John Franks, author of wn, for writing what I believe is the best webserver out there.
Links to documents relevant to Boa development and usage. Incomplete, we're still working on this. NCSA has a decent page along these lines, too.
Also see Yahoo's List
For unix-alike platforms, with published source code.
Also worth mentioning is Zeus.
It is commercial, with a free demo, so it doesn't belong on the list above.
Zeus seems to be based on technology similar to Boa and thttpd,
but with more bells and whistles.
Note: References last checked: 06 October 1997