Sean Caron scaron@umich.edu
Bijou is a HTTP server for Plan 9 that more or less follows RFC 1945 and RFC 2616. It is descended in a rather remote way from the skeleton of a previously written gopher server, implemented in a general enough fashion to be adaptable to use serving HTTP as well.
This release of Bijou is likely not the fastest HTTP server ever written, but it is quick enough for my platform and application and a fair bit of time was spent trying to ensure that it is reasonably robust. Bijou will do basically everything you need to serve up basic static sites including support for user home directory expansion, generalized directory translation and HTTP Basic authentication.
Have fun!
tar xvf bijou-1.0.tar
cd bijou-1.0/src
mk all
mk install
Examine and modify the configuration file /sys/www/etc/httpd.conf as desired
Replace the default web page in /sys/www/htdocs with desired content
/sys/www/bin/go
-
Implement methods besides GET and HEAD (e.g. PUT, POST, DELETE, TRACE)
-
Implement CGI (perl, rc, etc)
-
Try to guess MIME types of files that are being served up
The path to the configuration file is specified by the -f mandatory command line option when the HTTP server is started. The configuration file is just a plain text file that follows typical conventions. Comments are delimited by a pound sign as the first character on a line, and whitespace lines are ignored.
Configuration parameters are expressed in key=value pairs. Sometimes a configuration parameter may take multiple values, in which case it is expressed in the format key=value1,value2,value3.
Be sure that the last line in the configuration file is terminated with a newline, otherwise it will be ignored.
If there is a problem with the configuration file, the server will fail to start, and an error message will be logged to the console with the following format:
configuration file error N
The error code N may be cross referenced with the table below to determine the cause of the error.
Error code 1: Failed to open specified configuration file
Error code 2: Parse error or invalid key in configuration file
Error code 3: Duplicate key in configuration file
Error code 4: Missing required configuration parameter
Key: port (mandatory)
Example:
port=80
Key: hostname (mandatory)
Example:
hostname=yourserver.yourdomain.org
Key: icondir (mandatory)
Example:
icondir=/icons
Note: Directory must be expressed relative to the root directory. May be translated.
Key: rootdir (mandatory)
Example:
rootdir=/sys/www/htdocs
Key: indices (mandatory)
Examples:
indices=index.html
indices=index.html,index.htm,index.shtml
Note: May take either a single parameter or multiple parameters.
Key: userdirchar (mandatory)
Example:
userdirchar=~
Note: Character in URI to trigger user home directory expansion.
Key: userdirprefix (mandatory)
Example:
userdirprefix=/usr
Note: Directory prefix to append for user home directory expansion.
Key: userdirname (mandatory)
Example:
userdirname=public_html
Note: Directory to search for in user home while performing home directory expansion.
Key: reqlog (mandatory)
Example:
reqlog=/sys/www/logs/request.log
Note: HTTP request log
Key: errlog (mandatory)
Example:
errlog=/sys/www/logs/error.log
Note: HTTP error log
Key: translate (optional)
Example:
translate=/icons,/sys/www/icons
Note: Generalized directory translation. First argument is pattern to match, second is replacement text.
Key: htpassfile (optional)
Example:
htpassfile=.htpasswd
Note: File to check for in directories to interpret as htpasswd file. If the parameter is omitted, htpasswd support is disabled.
Like the main server configuration file, the htpasswd files are just plain text files that follow the typical conventions. Comments are delimited by a pound sign as the first character of a line, and whitespace lines are ignored.
The first non-comment line in the .htpasswd file is taken to be the authorization realm
Subsequent lines are assumed to be of the format,
username:encoded password
The encoded password is a really just a SHA-1 hash of the password entered for the user.
Complete htpasswd entries are generated by the htpasswd entry generator program. It is intended to be used as follows:
htpasswd username password >> .htpasswd
As with the main server configuration file, be sure that the last line in the htpasswd file is terminated with a newline, otherwise it will be ignored.
When htpasswd support is enabled and the server finds a htpasswd file with invalid format, or finds a directory with the htpasswd file name, it will give an internal server error and dump a message to the error log to assist in identifying the troublesome file.
The server is designed such that it will not show the htpasswd file in a directory listing, and will deny any requests for a htpasswd file from a client.
The icons.tar archive contains the standard set of icons used to denote file types in raw directory listings and is included from the Apache HTTP distribution.
The power36.gif graphic is included from the official Plan 9 site, http://plan9.bell-labs.com