man bozohttpd (Administration système) - bozohttpd

NAME

bozohttpd - hyper text transfer protocol version 1.1 daemon

SYNOPSIS

[-HVXbenrus] [-C suffix cgihandler] [-I port] [-M suffix type encoding encoding11] [-S server_software] [-c cgibin] [-i address] [-p pubdir] [-v virtualroot] [-x index] [-Z cert privkey]slashdir [myname]

DESCRIPTION

The program reads a request 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 myname as its name, which defaults to the local hostname, obtained from gethostname() (but see the -v option for virtual hosting.) is designed to be small, simple and relatively featureless, hopefully increasing its security.

OPTIONS

The following options are available:

-b
This option enables daemon mode, where detaches from the current terminal, running in the background and servicing HTTP requests.
-C suffix cgihandler
This option adds a new CGI handler program for a particularly 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.
-c cgibin
This option enables the CGI/1.1 interface. The cgibin directory is expected to contain the CGI programs to be used. looks for URL's in the form of where is a valid CGI program in the cgibin directory. In other words, all CGI URL's must begin with Note that the CGI/1.1 interface is not available with translation.
-e
This option causes to not clear the environment when used with either the -t or -U options.
-H
This option causes directory index mode to hide files and directories that start with a period, except for .. . Also see -X .
-I port
This option is only valid with the -b option. It causes port to use used as the port to bind daemon mode. The default is the port.
-i address
This option is only valid with the -b option. It causes address to use 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 gethostname(3) .
-M suffix type encoding encoding11
This option 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 and 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.
-n
This option stops 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.
-p pubdir
This option changes the default user directory for translations from to pubdir .
-r
This option forces pages besides the (see the -X option) page to require that the Referrer: header be present and refer to this web server, otherwise a redirect to the page will be returned instead.
-S server_software
This option sets the internal server version to server_software .
-s
This option forces logging to be set to stderr always.
-t chrootdir
When this option is used, will 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.
-U username
This option causes to switch to the user and the groups of username after initialization. This option, like -t above, causes to clear the environment unless the -e option is given.
-u
This option enables the transformation of Uniform Resource Locators of the form into the the directory ~user/public_html (see the -p option above). This option cannot be used in conjunction with the -t option.
-V
This option sets the default virtual host directory to slashdir . If no directory exists in virtualroot for the request, then slashdir will be used. The default behaviour is to return 404 (Not Found.)
-v virtualroot
This option 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 section for an example of using this option.
-X
This option enables directory indexing. A directory index will be generated only when the default file (i.e. index.html normally) is not present.
-x index
This option changes the default file read for directories from to index .
-Z certificate_path privatekey_path
This option 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 versions 20031005 and prior that supported the -C and -M 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 . )

INETD CONFIGURATION

As uses inetd() by default to process incoming TCP connections for HTTP requests (but see the -b option), has little internal networking knowledge. (Indeed, you can run it on the command line with little change of functionality.) A typical inetd.conf() entry would be: www stream tcp nowait:600 httpd /usr/pkg/libexec/bozohttpd bozohttpd /var/www www stream tcp6 nowait:600 httpd /usr/pkg/libexec/bozohttpd bozohttpd /var/www

This would serve web pages from /var/www on both IPv4 and IPv6 ports. The changes the requests per minute to 600, up from the inetd() default of 40.

Using the inetd(8) , you can provide multiple IP-address based HTTP servers by having multiple listening ports with different configurations.

EXAMPLES

To configure set of virtual hosts, one would use an entry like: www stream tcp nowait:600 httpd /usr/pkg/libexec/bozohttpd bozohttpd -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.

To use with PHP, one must use the -C option to specify a CGI handler for a particular file type. Typically this, this will be like: bozohttpd -C .php /usr/pkg/bin/php /var/www

NOTES

This server supports the and standards. The support is based on the Internet Draft which has been replaced by RFC 2616 as the standard. 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), and dynamic MIME content (NO_DYNAMIC_CONTENT), and SSL support (NO_SSL_SUPPORT) by defining the listed macros when building .

HTTP BASIC AUTHORISATION

has support for HTTP Basic Authorisation that is excluded by default. Compile with on the compiler command line to enable this support. It may require linking with the crypt library, using .

FILES

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 -r option. If a .bzredirect symbolic link is found, will perform a smart redirect to the target of this symlink. The target is assumed to live on the same server. If a .bzabsredirect symbolic link is found, will redirect to the absolute url pointed to by this symlink. This is useful to redirect to different servers.

SSL SUPPORT

has support for SSLv2, SSLv3, and TLSv1 protocols that is included by default. It requires linking with the crypto and ssl library, using To disable SSL SUPPORT compile with on the compiler command line.

SEE ALSO

inetd.conf(5) ,inetd()

HISTORY

The program was first written in perl, based on another perl http server called It was then rewritten from scratch in perl, and then once again in C. The focus has always been simplicity and security, with minimal features and regular code audits. This manual documents version 20050410.

AUTHORS

was written by Matthew R. Green

The large list of contributors includes:

•
Julian Coleman provided an IPv6 bugfix
•
Chuck Cranor provided cgi-bin support fixes, and more
•
Andrew Doran provided directory indexing support
•
Per Ekman provided a fix for a minor (non-security) buffer overflow condition
•
Zak Johnson provided cgi-bin enhancements
•
Jun-ichiro itojun Hagino, KAME provided initial IPv6 support
•
Martin Husemann provided .bzabsredirect support
•
Roland Illig provided some off-by-one fixes
•
Nicolas Jombart provided fixes for HTTP basic authorisation support
•
Thomas Klausner provided many fixes and enhancements for the man page
•
Johnny Lam provided man page fixes
•
Luke Mewburn provided many various fixes, including cgi-bin fixes & enhancements, HTTP basic authorisation support and much code clean up
•
Scott Reynolds provided various fixes
•
Tyler Retzlaff provided SSL support, cgi-bin fixes and random other stuff
•
Steve Rumble provided the -V option.
•
ISIHARA Takanori provided a man page fix
•
provided chroot and change-to-user support, and other various fixes

There are probably others I have forgotten (let me know if you care)

BUGS

does not handled HTTP/1.1 chunked input from the client yet.