NAME
rc–httpd – HTTP server |
SYNOPSIS
rc–httpd/rc–httpd |
DESCRIPTION
Rc–httpd serves the requested file or an index of files found under
a website's root directory, or, in the case of CGI, executes a
specified CGI program. |
CONFIGURATION
As all pieces of rc–httpd are shell scripts, configuration is achieved
by setting variables and adding, removing or modifying commands
in various files. rc–httpd rc_httpd_dir must be set to the root of the rc–httpd installation, the directory containing the rc–httpd script. path must include rc_httpd_dir/handlers ahead of the base system's path elements. cgi_path is substituted for path when cgi scripts are run. (Be sure to set path back in rc–based cgi scripts.) extra_headers is an optional list of strings to emit when sending http headers. SERVER_PORT is the port HTTP is to be served on. select–handler PATH_INFO is the location relative to the website's root directory of the file to be displayed. Typically, the location from the incoming request is honored. FS_ROOT sets the root directory of the website. NOINDEXFILE instructs the dir–index module not to look for index.html files, otherwise if an index.html file is found dir–index will exec serve–static to serve the file. At present there is no module to serve an index file but not a directory. If you do not want directory indexing at all, replace static–or–index with serve–static, which will report 503 forbidden for directories. Multiple virtual hosts may be configured by creating conditional statements that act upon the SERVER_NAME variable. Fine–grained control of specific request strings may be configured via a similar method acting upon the location and/or other variables.
The REMOTE_USER variable provides a user identification string
supplied by the client as part of user authentication. |
EXAMPLES
The following examples demonstrate possible ways to configure
select–handler.
Serve static files:
|
STARTUP
Rc–httpd is run from a file in the directory scanned by listen(8),
or called as an argument to aux/listen1. The program's standard
error may be captured to a log file:
|
FILES
/rc/bin/rc–httpd/rc–httpd /rc/bin/rc–httpd/select–handler /rc/bin/rc–httpd/handlers/authorize /rc/bin/rc–httpd/handlers/cgi /rc/bin/rc–httpd/handlers/dir–index /rc/bin/rc–httpd/handlers/error /rc/bin/rc–httpd/handlers/redirect /rc/bin/rc–httpd/handlers/serve–static /rc/bin/rc–httpd/handlers/static–or–cgi /rc/bin/rc–httpd/handlers/static–or–index /rc/bin/service/tcp80 /sys/log/www |
SOURCE
/rc/bin/rc–httpd |
SEE ALSO
rc(1), listen(8) |
HISTORY
Rc–httpd first appeared in 9front (February, 2013). |