NHTTPD(8)

NAME
nhttpd - Nostromo webserver

SYNOPSIS
nhttpd [-hvr46] [-c configfile]

DESCRIPTION
nhttpd is a simple, fast and secure HTTP server. It runs as a single process and just forks if a cgi or directory listing is invoked. It supports html, cgi, chroot, setuid, basic authentication, virtual hosts, aliases, ssl and ipv6. To stop the server send a SIGTERM signal to the PID. The access log is written in standard CLF format.

OPTIONS

-h  Prints short listing of nhttpd options.

-v  Prints version.

-r  nhttpd will chroot(2) to serverroot. If you use this option, you have to change docroot, cgiroot, virtual hosts and aliases in configfile to paths within your serverroot.

-4  Enable IPv4 and IPv6.

-6  Enable IPv6 only.

-c configfile
    Uses configfile as configuration file. If this option is not set, /var/nostromo/conf/nhttpd.conf will be used by default.

SETUID
For security reasons it is recommended to run nhttpd with an extra user. To do that create a new user on your system which has a valid entry in the /etc/passwd file. Then set the user option in your configfile to that user. It is necessary to start nhttpd as root, so it can switch to that user afterwards. If the user option is not set, nhttpd will run under the user who started it, except root!

Be sure that the permissions on your docroot are set correct, as nhttpd needs write permissions at least on the logs directory.

BASIC AUTHENTICATION
To ask for basic authentication on certain directories within your docroot you have to create a file in that directory named like set by the htaccess option in your configfile. The htaccess file should contain one line including the realm option like in this example:

    realm Unix Developers Realm

If the realm option can not be parsed from the htaccess file, it will be set to a default value saying 'unknown realm'.

The list of authorized users and their passwords (DES encrypted) are stored in the file set by the htpasswd option in configfile. To create a new user entry in this file, use the crypt tool.

All subdirectories below the htaccess file are protected automaticly. The client will be prompted for basic authentication if accessing such a protected directory.

VIRTUAL HOSTS
To serve virtual hosts, just add a line for each virtual host in configfile with the domainname as option and port if not 80, and the docroot of that virtual host, as in this example:

    www.rahel.ch     /var/nostromo/htdocs/www.rahel.ch
    www.nazgul.ch:81 /var/nostromo/htdocs/www.nazgul.ch

For each virtual host a seperate access_log is been written automaticly with the following syntax as example:

    access_log-www.rahel.ch
    access_log_www.nazgul.ch:81

ALIASES
With aliases you can create a fake path which will point to a real path. For example, to let all links starting with /icons point to another path, just add the following line in your configfile:

    /icons /var/nostromo/icons

SSL
nhttpd uses the OpenSSL library, so be sure you have it installed on your system. To activate ssl uncomment sslport which is the port where we will listen for ssl connections, sslcert which is the certificate file, and sslcertkey which is the certificate key file. If the certificate and the key are correct nhttpd will startup with a log entry for ssl activation in the server log, otherwise it will complain and the startup is aborted. After a successfull startup we are able to handle secure https connections.

FILES
/var/nostromo/conf/nhttpd.conf
    server configuration
/var/nostromo/conf/mimes
    mime types
/var/nostromo/logs/nhttpd.log
    server log
/var/nostromo/logs/nhttpd.pid
    pid file
/var/nostromo/logs/access_log
    http log
/usr/local/sbin/crypt
    create user with DES password
/usr/local/sbin/nhttpd
    http daemon

HISTORY
First version of nhttpd appeared in 2004.

THANKS
Thanks to Marc Balmer, Daniel Hartmeier, Boris Meyer and Wouter Schoot for their support.

AUTHORS
Marcus Glocker <marcus@nazgul.ch>