— hyper text transfer
protocol version 1.1 daemon
[-M suffix type
encoding encoding11] [-P
program reads a HTTP
from the standard input, and sends a reply to the standard output. Besides
~user translation and virtual hosting support (see below), all file requests
are from slashdir
directory. The server uses
as its name, which defaults to the local
hostname, obtained from
see the -v
option for virtual hosting.)
writes logs to
using the ftp
facility (but see the -s
option for testing.)
is designed to be small, simple and relatively
featureless, hopefully increasing its security.
The following options are available:
- Enables daemon mode, where bozohttpd
detaches from the current terminal, running in the background and
servicing HTTP requests.
- Adds a new CGI handler program for a particular file type.
The suffix should be any normal file suffix, and the
cgihandler should be a full path to an interpreter.
This option is the only way to enable CGI programs that exist outside of
the cgibin directory to be executed. Multiple -C options
may be passed.
- Enables the CGI/1.1 interface. The
cgibin directory is expected to contain the CGI
programs to be used. bozohttpd looks for URL's in the
form of /cgi-bin/<scriptname> where
⟨scriptname⟩ is a valid CGI program in the
cgibin directory. In other words, all CGI URL's must
begin with /cgi-bin/. Note that the CGI/1.1 interface is
available with ~user translation using
- Causes bozohttpd to not clear the
environment when used with either the -t or
- Stops the -b flag from
bozohttpd detaching from the tty and going into the
- Get the bozohttpd version string, print
it on standard output, and exit.
- Causes directory index mode to hide files and directories
that start with a period, except for ... Also see
- Causes bozohttpd to use
port instead of the default “http” port.
When used with the -b option, it changes the bound port.
Otherwise it forces redirections to use this port instead of the value
- Causes address to be used as the
address to bind daemon mode. If otherwise unspecified, the address used to
bind is derived from the myname, which defaults to
the name returned by
Only the last -i option is used. This option is only
valid with the -b option.
- Adds a new Lua script for a particular prefix. The
prefix should be an arbitrary text, and the
script should be a full path to a Lua script.
Multiple -L options may be passed. A separate Lua state
is created for each prefix. The Lua script can register callbacks using
the httpd.register_handler('<name>', function) Lua function, which
will trigger the execution of the Lua function function
when a URL in the form
being accessed. The function is passed three tables as arguments, the
server environment, the request headers, and the decoded query string plus
any data that was sent as application/x-www-form-urlencoded.
suffix type encoding encoding11
- Adds a new entry to the table that converts file suffixes
to content type and encoding. This option takes four additional arguments
containing the file prefix, its “Content-Type”,
“Content-Encoding”, and “Content-Encoding” for
HTTP/1.1 connections, respectively. If any of these are a single dash
(“-”), the empty string is used instead. Multiple
-M options may be passed.
- Stops bozohttpd from doing IP address to
name resolution of hosts for setting the
REMOTE_HOST variable before running a CGI program.
This option has no effect without the -c option.
- Causes bozohttpd to create a pid file in
pidfile when run in daemon mode with the
- Changes the default user directory for
/~user/ translations from “public_html” to
- Sets the internal server version to
- Forces logging to be set to stderr always.
- Makes bozohttpd chroot to the specified
directory before answering requests. Every other path should be specified
relative to the new root, if this option is used. Note that the current
environment is normally replaced with an empty environment with this
option, unless the -e option is also used.
- Causes bozohttpd to switch to the user
and the groups of username after initialization.
This option, like -t above, causes
bozohttpd to clear the environment unless the
-e option is given.
- Enables the transformation of Uniform Resource Locators of
the form /~user/ into the directory
~user/public_html (but see the -p
- Enables CGI/1.1 interface for ~user
translation. Note that enabling this support implies that users can run
commands as web server user, this may have security implications.
- Sets the backup virtual host directory to the
slashdir argument. If no directory exists in
virtualroot for the request, then
slashdir will be used. The default behaviour is to
return 404 (Not Found.)
- Enables virtual hosting support. Directories in
virtualroot will be searched for a matching virtual
host name, when parsing the HTML request. If a matching name is found, it
will be used as both the server's real name,
[myname], and as the
slashdir. See the
EXAMPLES section for an example of
using this option.
- Enables directory indexing. A directory index will be
generated only when the default file (i.e. index.html
normally) is not present.
- Changes the default file read for directories from
“index.html” to index.
- Sets the list of SSL ciphers (see
- Sets the path to the server certificate file and the
private key file in pem format. It also causes bozohttpd
to start SSL mode.
Note that in bozohttpd
versions 20031005 and prior that
supported the -C
options, they took
a single space-separated argument that was parsed. since version 20040828,
they take multiple options (2 in the case of -C
and 4 in the
case of -M
by default to
process incoming TCP connections for HTTP requests (but see the
has little internal
networking knowledge. (Indeed, you can run it on the command line with little
change of functionality.) A typical
http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd /var/www
http stream tcp6 nowait:600 _httpd /usr/libexec/httpd httpd /var/www
This would serve web pages from /var/www
on both IPv4 and IPv6
ports. The :600
changes the requests per minute to 600, up
from the inetd(8)
Using the NetBSD
, you can provide
multiple IP-address based HTTP servers by having multiple listening ports with
This server supports the HTTP/0.9
standards. Support for these protocols is very
minimal and many optional features are not supported.
can be compiled without CGI support
(NO_CGIBIN_SUPPORT), user transformations (NO_USER_SUPPORT), directory index
support (NO_DIRINDEX_SUPPORT), daemon mode support (NO_DAEMON_MODE), dynamic
MIME content (NO_DYNAMIC_CONTENT), Lua support (NO_LUA_SUPPORT), and SSL
support (NO_SSL_SUPPORT) by defining the listed macros when building
HTTP BASIC AUTHORISATION
has support for HTTP Basic Authorisation. If a file
exists in the directory of the current
will restrict access to documents in that
directory using the RFC 2617 HTTP “Basic” authentication scheme.
Note: This does not recursively protect any sub-directories.
file contains lines delimited with a colon
containing usernames and passwords hashed with
, for example:
utility may be
used to generate hashed passwords.
has support for HTTP Basic Authorisation
enabled by default, in the portable distribution it is excluded. Compile
with “-DDO_HTPASSWD” on the compiler
command line to enable this support. It may require linking with the crypt
library, using “-lcrypt”.
has support for TLSv1.1 and TLSv1.2 protocols that
are included by default. It requires linking with the crypto and ssl library,
using “-lcrypto -lssl”. To disable SSL SUPPORT compile
with “-DNO_SSL_SUPPORT” on the
compiler command line.
supports a very basic form of compression.
will serve the requested file postpended with
” if it exists, it is readable, the client
requested gzip compression, and the client did not make a ranged request.
looks for a couple of special files in directories
that allow certain features to be provided on a per-directory basis. In
addition to the .htpasswd
used by HTTP basic authorisation,
if a .bzdirect
file is found (contents are irrelevant)
will allow direct access even with the
option. If a .bzredirect
is found, bozohttpd
will perform a smart redirect to the
target of this symlink. The target is assumed to live on the same server. If
target starts with slash then absolute redirection is performed, otherwise
it's handled as relative. If a .bzabsredirect
is found, bozohttpd
will redirect to the absolute url
pointed to by this symlink. This is useful to redirect to different servers.
Two forms of redirection are supported - symbolic link without schema will use
as default i.e. link to NetBSD.org
will redirect to http://NetBSD.org/
schema will be used i.e. symbolic link to ftp://NetBSD.org/
will redirect to the provided URL.
To configure set of virtual hosts, one would use an
http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd -v /var/vroot /var/www
and inside /var/vroot
create a directory (or a symlink to a
directory) with the same name as the virtual host, for each virtual host.
Lookups for these names are done in a case-insensitive manner, and may include
the port number part of the request, allowing for distinct virtual hosts on
the same name.
To use bozohttpd
with PHP, one must use the
option to specify a CGI handler for a particular file
type. Typically this will be like:
httpd -C .php /usr/pkg/bin/php-cgi /var/www
was first written in perl, based on another perl
http server called “tinyhttpd”. It was then rewritten from scratch
in perl, and then once again in C. From “bozohttpd” version
20060517, it has been integrated into NetBSD
focus has always been simplicity and security, with minimal features and
regular code audits. This manual documents bozohttpd
was written by Matthew R.
The large list of contributors includes:
- Marc Balmer
added Lua support for dynamic content creation
- Christoph Badura
Range: header support
- Sean Boudreau
provided a security fix for virtual hosting
- Julian Coleman
provided an IPv6 bugfix
- Chuck Cranor
provided cgi-bin support fixes, and more
- Alistair G. Crooks
cleaned up many internal interfaces, made bozohttpd
linkable as a library and provided the Lua binding.
- DEGROOTE Arnaud
provided a fix for daemon mode
- Andrew Doran
provided directory indexing support
- Per Ekman
provided a fix for a minor (non-security) buffer overflow condition
- Roland Dowdeswell
added support for serving gzipped files and better SSL handling
- Jun-ichiro itojun Hagino, KAME
provided initial IPv6 support
- Martin Husemann
provided .bzabsredirect support, and fixed various redirection issues
- Arto Huusko
provided fixes cgi-bin
- Roland Illig
provided some off-by-one fixes
- Zak Johnson
- Nicolas Jombart
provided fixes for HTTP basic authorisation support
- Antti Kantee
provided fixes for HTTP basic authorisation support
- Thomas Klausner
provided many fixes and enhancements for the man page
- Mateusz Kocielski
fixed memory leaks, various issues with userdir support, information
disclosure issues, added support for using CGI handlers with directory
indexing, found several security issues and provided various other
- Arnaud Lacombe
provided some clean up for memory leaks
- Johnny Lam
provided man page fixes
- Dennis Lindroos
provided a cgi-bin fix
- Julio Merino
Added the -P option (pidfile support) and provided some
man page fixes.
- Luke Mewburn
provided many various fixes, including cgi-bin fixes and enhancements,
HTTP basic authorisation support and much code clean up
- Rajeev V. Pillai
provided several fixes for virtual hosting
- Jeremy C. Reed
provided several clean up fixes, and man page updates
- Scott Reynolds
provided various fixes
- Tyler Retzlaff
provided SSL support, cgi-bin fixes and much other random other stuff
minor compile fixes and a CGI content map fix
- Steve Rumble
provided the -V option.
- Thor Lancelot Simon
enhanced cgi-bin support.
- Joerg Sonnenberger
implemented If-Modified-Since support
- ISIHARA Takanori
provided a man page fix
- Holger Weiss
provided http authorisation fixes
provided chroot and change-to-user support, and other various fixes
- Coyote Point provided various CGI fixes.
There are probably others I have forgotten (let me know if you care)
Please send all updates to bozohttpd
for inclusion in future releases.
does not handle HTTP/1.1 chunked input from the