thttpd
This page describes the thttpd
web server you can use as part of the third project. Unless
otherwise indicated, all files mentioned in this page can be found in
/export/home/class/cs-537/p3/thttpd-2.20c
This page will describe only enough to get you started with thttpd
; see
the man page thttpd.8
or the PostScript version thttpd.ps
if you're
interested in more information about thttpd
.
You may run thttpd
in any directory; the directory in which you run
thttpd
is known as the home directory. thttpd
searches only the
home directory for any files requested by clients.
thttpd
accepts a number of options, but the three most important ones are
-p
, -D
, and -c
.
-D
option prevents thttpd
from running as a deamon. By
default, thttpd
forks a copy of itself and runs in background. From the
command line, it looks as if thttpd
is immediately exiting, which can be
confusing until you realize what's going on. The -D
option prevents the
fork, making thttpd
execute in foreground.
-p
option sets the TCP port on which thttpd
listens. The
default is port 80, which is a well-known port. Unless you're running
thttpd
as root, it will fail if it tries to open port 80, and you'll have
to specify some other port using -p
.
-c
option indicates the directory in which thttpd
looks
for cgi programs. The default is to not look for cgi programs; if you don't
run thttpd
with the -c
option, it won't execute cgi programs.
The -c
option takes an argument specifying which files can be used as cgi
programs. The argument uses shell-style meta-characters to specify files
relative to the home directory. For example, -c '/*'
indicates
that files in the home directory are cgi programs, while -c
'/cgi-bin/*'
indicates that files in the sub-directory cgi-bin
are
cgi programs.
Any program you want to run as a cgi program must have other execute permissions set.
$ ls -l printenv total 4 -r-x------ 1 rclayton faculty 342 Feb 13 2000 printenv $ chmod o+x printenv $ ls -l printenv total 4 -r-x-----x 1 rclayton faculty 342 Feb 13 2000 printenv $
This page last modified on 9 April 2002.