W3C httpd

Installing W3C httpd Under inetd

This is how to to set up inetd to run httpd whenever a request comes in. (These steps are the same for any daemon under unix: you will probably find a similar thing has been done for the FTP daemon, ftpd, for example.)

Step 1: Install httpd Binary

Copy httpd into a suitable directory such as /usr/etc. Make it owned by root, and make it writable only to root, for example by saying:
        chmod 755 httpd

Step 2: Add http Service to /etc/services

Put "http" in the /etc/services file, or use the name of a specific service of your own if you want to use a special port number. Standard port number for HTTP is 80.
        http    80/tcp           # WWW server

Step 3: Add a Line to /etc/inetd.conf

Put a line in the internet daemon configuration file, /etc/inetd.conf.
    http  stream  tcp  nowait  root  /usr/etc/httpd  httpd
First word is the same as in /etc/services file.

If you want to pass command line options or parameters to httpd, they would listed be in the end of line, for example to set the rule file to something else than the default /etc/httpd.conf:

    http  stream  tcp  nowait  root  /usr/etc/httpd  httpd -r /my/own/rules
Note: For httpd version 2.15 and later we recommend that it is run as user root. Running httpd as root is safe, since it automatically resets its user-id to nobody. However, if you decide to use access authorization features, and you need to serve protected files, httpd will have to be able to set its user-id to some other uid as well. In any case, httpd always sets its user-id to something other than root before serving the file to the client.

Note: /etc/inetd.conf syntax varies from system to system, for example all systems don't have the field specifying the user name, in which case the default is root. If in doubt, sopy the format of other lines in your existing inetd.conf.

Note: There seems to be a limit of 4 arguments passed across by inetd, at least on the NeXT.

Step 4: Send HUP Signal to inetd

When you have updated inetd.conf, find out the process number of inetd, and send a "HUP" signal to it.

For example on BSD unix do this:

        > ps -aux | grep inetd | grep -v grep
        root    85   0.0  0.9 1.24M  304K ?  S  0:01 /usr/etc/inetd
        > kill -HUP 85
For system V, use ps -el instead of ps -aux. Be aware that on some systems your local file /etc/services may not be consulted by your system (see notes on debugging).

Test It!

httpd@w3.org, July 1995