1 .\" $NetBSD: bozohttpd.8,v 1.15 2009/05/23 20:26:18 wiz Exp $
3 .\" $eterna: bozohttpd.8,v 1.91 2009/05/23 00:55:22 mrg Exp $
5 .\" Copyright (c) 1997-2009 Matthew R. Green
6 .\" All rights reserved.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\" notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\" notice, this list of conditions and the following disclaimer in the
15 .\" documentation and/or other materials provided with the distribution.
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
22 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 .Nd hyper text transfer protocol version 1.1 daemon
38 .Op Fl C Ar suffix cgihandler
42 .Op Fl M Ar suffix type encoding encoding11
44 .Op Fl S Ar server_software
46 .Op Fl v Ar virtualroot
48 .Op Fl Z Ar cert privkey
56 request from the standard input, and sends a reply to the standard output.
57 Besides ~user translation and virtual hosting support (see below), all file
63 as its name, which defaults to the local hostname, obtained from
67 option for virtual hosting.)
69 is designed to be small, simple and relatively featureless,
70 hopefully increasing its security.
72 The following options are available:
73 .Bl -tag -width xxxcgibin
75 This option enables daemon mode, where
77 detaches from the current terminal, running in the background and
78 servicing HTTP requests.
79 .It Fl C Ar suffix cgihandler
80 This option adds a new CGI handler program for a particular file type.
83 should be any normal file suffix, and the
85 should be a full path to an interpreter.
86 This option is the only way to enable CGI programs that exist
87 outside of the cgibin directory to be executed.
90 options may be passed.
92 This option enables the CGI/1.1 interface.
95 directory is expected to contain the CGI programs to be used.
97 looks for URL's in the form of
98 .Em /cgi-bin/\*[Lt]scriptname\*[Gt]
101 is a valid CGI program in the
104 In other words, all CGI URL's must begin with
106 Note that the CGI/1.1 interface is not available with
112 to not clear the environment when used with either the
118 This option stops the
122 detaching from the tty and going into the background.
124 This option causes directory index mode to hide files and directories
125 that start with a period, except for
130 This option is only valid with the
135 to use used as the port to bind daemon mode.
140 This option is only valid with the
145 to use used as the address to bind daemon mode.
146 If otherwise unspecified, the address used to bind is derived from the
148 which defaults to the name returned by
153 .It Fl M Ar suffix type encoding encoding11
154 This option adds a new entry to the table that converts file suffixes to
155 content type and encoding.
156 This option takes four additional arguments containing
159 .Dq Content-Encoding ,
162 for HTTP/1.1 connections, respectively.
163 If any of these are a single dash
165 the empty string is used instead.
168 options may be passed.
172 from doing IP address to name resolution of hosts for setting the
174 variable before running a CGI program.
175 This option has no effect without the
179 This option changes the default user directory for
186 This option forces pages besides the
190 option) page to require that the Referrer: header be present and
191 refer to this web server, otherwise a redirect to the
193 page will be returned instead.
194 .It Fl S Ar server_software
195 This option sets the internal server version to
196 .Ar server_software .
198 This option forces logging to be set to stderr always.
199 .It Fl t Ar chrootdir
200 When this option is used,
202 will chroot to the specified directory
203 before answering requests.
204 Every other path should be specified relative
205 to the new root, if this option is used.
206 Note that the current environment
207 is normally replaced with an empty environment with this option, unless the
213 to switch to the user and the groups of
215 after initialization.
220 to clear the environment unless the
224 This option enables the transformation of Uniform Resource Locators of
228 .Pa ~user/public_html
233 This option sets the default virtual host directory to
235 If no directory exists in
237 for the request, then
240 The default behaviour is to return 404 (Not Found.)
241 .It Fl v Ar virtualroot
242 This option enables virtual hosting support.
245 will be searched for a matching virtual host name, when parsing
247 If a matching name is found, it will be used
248 as both the server's real name,
254 section for an example of using this option.
256 This option enables directory indexing.
257 A directory index will be generated only when the default file (i.e.
259 normally) is not present.
261 This option changes the default file read for directories from
265 .It Fl Z Ar certificate_path privatekey_path
266 This option sets the path to the server certificate file and the private key file
275 versions 20031005 and prior that supported the
279 options, they took a single space-separated argument that was parsed.
280 since version 20040828, they take multiple options (2 in the case of
284 .Ss INETD CONFIGURATION
289 by default to process incoming TCP connections for HTTP requests
294 has little internal networking knowledge.
295 (Indeed, you can run it on the command line with little change of functionality.)
300 http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd /var/www
301 http stream tcp6 nowait:600 _httpd /usr/libexec/httpd httpd /var/www
304 This would serve web pages from
306 on both IPv4 and IPv6 ports.
310 requests per minute to 600, up from the
317 you can provide multiple IP-address based HTTP servers by having multiple
318 listening ports with different configurations.
320 This server supports the
326 Support for these protocols is very minimal and many optional features are
330 can be compiled without CGI support (NO_CGIBIN_SUPPORT), user
331 transformations (NO_USER_SUPPORT), directory index support (NO_DIRINDEX_SUPPORT),
332 daemon mode support (NO_DAEMON_MODE), and dynamic MIME content
333 (NO_DYNAMIC_CONTENT), and SSL support (NO_SSL_SUPPORT) by defining the listed
336 .Ss HTTP BASIC AUTHORISATION
338 has support for HTTP Basic Authorisation.
341 exists in the directory of the current request,
343 will restrict access to documents in that directory
344 using the RFC 2617 HTTP
346 authentication scheme.
349 This does not recursively protect any sub-directories.
353 file contains lines delimited with a colon containing
354 usernames and passwords hashed with
358 heather:$1$pZWI4tH/$DzDPl63i6VvVRv2lJNV7k1
366 utility may be used to generate hashed passwords.
372 has support for HTTP Basic Authorisation enabled by default,
373 in the portable distribution it is excluded.
378 on the compiler command line to enable this support.
379 It may require linking with the crypt library, using
383 has support for SSLv2, SSLv3, and TLSv1 protocols that is included by
385 It requires linking with the crypto and ssl library, using
387 To disable SSL SUPPORT compile
391 on the compiler command line.
394 looks for a couple of special files in directories that allow certain features
395 to be provided on a per-directory basis.
398 used by HTTP basic authorisation,
401 file is found (contents are irrelevant)
403 will allow direct access even with the
408 symbolic link is found,
410 will perform a smart redirect to the target of this symlink.
411 The target is assumed to live on the same server.
414 symbolic link is found,
416 will redirect to the absolute url pointed to by this symlink.
417 This is useful to redirect to different servers.
419 To configure set of virtual hosts, one would use an
423 http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd -v /var/vroot /var/www
428 create a directory (or a symlink to a directory) with the same name as
429 the virtual host, for each virtual host.
430 Lookups for these names are done in a case-insensitive manner.
434 with PHP, one must use the
436 option to specify a CGI handler for a particular file type.
437 Typically this, this will be like:
439 httpd -C .php /usr/pkg/bin/php /var/www
447 program is actually called
449 It was first written in perl, based on another perl http server
452 It was then rewritten from scratch in perl, and then once again in C.
455 version 20060517, it has been integrated into
457 The focus has always been simplicity and security, with minimal features
458 and regular code audits.
459 This manual documents
464 was written by Matthew R. Green
465 .Aq mrg@eterna.com.au .
467 The large list of contributors includes:
472 provided some clean up for memory leaks
476 provided Range: header support
480 provided an IPv6 bugfix
483 .Aq chuck@research.att.com
484 provided cgi-bin support fixes, and more
487 .Aq degroote@netbsd.org
488 provided a fix for daemon mode
492 provided directory indexing support
496 provided a fix for a minor (non-security) buffer overflow condition
498 Jun-ichiro itojun Hagino, KAME
499 .Aq itojun@iijlab.net
500 provided initial IPv6 support
503 .Aq martin@netbsd.org
504 provided .bzabsredirect support
507 .Aq arto.huusko@pp2.inet.fi
508 provided fixes cgi-bin
511 .Aq roland.illig@gmx.de
512 provided some off-by-one fixes
516 provided cgi-bin enhancements
520 provided fixes for HTTP basic authorisation support
523 .Aq wiz@danbala.ifoer.tuwien.ac.at
524 provided many fixes and enhancements for the man page
528 provided man page fixes
532 provided many various fixes, including cgi-bin fixes and enhancements,
533 HTTP basic authorisation support and much code clean up
537 provided several clean up fixes, and man page updates
540 .Aq scottr@netbsd.org
541 provided various fixes
544 .Aq rtr@eterna.com.au
545 provided SSL support, cgi-bin fixes and much other random other stuff
548 .Aq rumble@ephemeral.org
555 implemented If-Modified-Since support
558 .Aq ishit@oak.dti.ne.jp
559 provided a man page fix
562 .Aq holger@CIS.FU-Berlin.DE
563 provided http authorisation fixes
566 provided chroot and change-to-user support, and other various fixes
568 Coyote Point provided various CGI fixes
571 There are probably others I have forgotten (let me know if you care)
573 Please send all updates to
576 .Aq mrg@eterna.com.au
577 for inclusion in future releaases.
580 does not handled HTTP/1.1 chunked input from the client yet.