ZJHTTPD(1) FreeBSD General Commands Manual ZJHTTPD(1) NAME zjhttpd - A Hypertext Transfer Protocol server SYNOPSIS zjhttpd [-h] [-f conf-file] [-u user] [-g group] [-d www-dir] [-i index-file] [-e error-path] [-dotfiles] [-nodotfiles] [-ct content-type] [-extlog] [-noextlog] [-dirlisting] [-nodirlisting] DESCRIPTION zjhttpd is a server intended to provide webpages using the Hypertext Transfer Protocol HTTP/1.1 (RFC 2616). It uses the inetd(8) superserver to manage the networking stuff. Available options: -h print out a help screen and exit. -f use conf-file as alternative configuration file. If this option is missing, the default path (/usr/local/etc/zjhttpd.conf) will be used. -u set user as the process' owner. user can either be a username known by the system, or a numeric user-id. If this option is missing, the owner won't be switched. Note that you can also specify the owner in inetd.conf(8) -g set group as the process' group. group can either be a groupname known by the system, or a numeric group-id. If this option is missing, the group won't be switched. Note that you can also specify the group in inetd.conf(8) -d tells the server to take the files that will be provided from www-dir. If this option is missing, the appropriate value in the configuration will be used. If that should also be missing, the default (/var/www/) will be used. -i use index-file as default index file that will be sent when a directory is requested. If this option is missing, the appropri- ate value in the configurtaion will be used. If that should also be missing, the default (index.html) will be used. -e take HTML error messages from error-path. If this option is missing, the appropriate value in the configuration will be used. If that should also be missing, zjhttpd won't send HTML error messages, but built-in text/plain messages. -dotfiles if this flag is given, the server will deliver dotfiles. -nodotfiles overrides the dotfile behaviour (e.g. from config). -ct use content-type as default content-type if the server cannot make a guess base on the filename extension. Default is text/plain. -extlog turns extedned logging on (+agent, +referer). -noextlog turns extended logging off. -dirlisting enables directory browsing (if no index-file exists). -nodirlisting disables directory browsing. As you already noticed, the command line arguments override the settings made in the configuration file. You can reach all options directly via the command line, that's why zjhttpd will work without having the default configuration file (/usr/local/etc/zjhttpd.conf) existing. You may also have noticed, that the -u and -g options seem not to be very useful when working with inetd(8). That is right, but it makes it possi- ble to use zjhttpd together with other internet superservers that don't provide this feature. If you want to provide formatted HTML error messages, create a directory, tell zjhttpd where to find it (either with the -e option, or in the con- figuration file) and place the files there. The naming scheme is really simple: use 404.html for the HTTP 404 Not Found message and so on. You can mix HTML error messages with the built-in text/plain messages. If a HTML error message isn't present, the text/plain variant will be sent instead. NOTE: Use as www-dir always a real path, e.g. /usr/home/www/files/ instead of /home/www/files if /home/ is a symlink to /usr/home/. CONFIGURATION FILE zjhttpd can use a configuration file. Note that the options provided on the command line will override the ones from the configuration file. The syntax is really simple: key = value Where key is one of the following options: user user to switch to group group to switch to www_dir directory with files to provide index index file used when directory requested error_file_path path to HTML error messages dotfiles deliver dotfiles if requested (yes|no) default_content_type default content-type if server cannot guess extended_logging log agent and referer also (yes|no) dirlisting send directory listing if index is missing (yes|no) You may quote the values with quotation marks (which I prefer), but it also works without them. Lines starting with a hash (#) are treated as comment, empty lines are ignored. FEATURES Here is a list of features zjhttpd provides: o Moved Permanently and Moved Temporarily messages using symlinks o If-Modified-Since and If-Unmodified-Since for caches o Directory browsing o Persistent Connections ("Keep-Alive") and Pipelined Requests o Ranges (multiple, not only the simple case!) o Uses the Common Log File Format Since zjhttpd is under development it is only fair to give you a taste of features that will be implemeneted in later versions: o CGI support for GET and POST o Multi language support o gzip Transfer-Encoding to save bandwidth o HTTP Basic Authentication But you will probably more interested in the symlink-stuff mentioned above. zjhttpd deals symlinks by examining their "destination". If it is a local symlink, it will send a HTTP 307 Moved Temporarily message with the new path (btw. always a text/plain message). If you have an external target (one containing :// like in http://www.foo.org/bar.html) zjhttpd will create a HTTP 301 Moved Permanently message. This is useful if you want to move from one place to another, and don't want your visitors to be frustrated by HTTP 404 Not Found errors. There are also many robots that understand this messages, e.g. search engines will update their database faster then receiving this messages. LOGFILE zjhttpd logs via syslogd(8) using the LOG_DAEMON facility and LOG_INFO priority. By default those message aren't logged, so you may want to edit your syslog.conf to make this work. For more information about that, have a look at syslog.conf(5). FILES /usr/local/etc/zjhttpd.conf default configuration file /var/www/ default directory for files to be provided SEE ALSO inetd(8), syslogd(8), syslog.conf(5) AUTHORS Felix Opatz FreeBSD 4.7 October 7, 2003 FreeBSD 4.7