W3C httpd install

Installing W3C httpd

This section describes how to install W3C httpd.

Getting the Program

Often you don't need to compile the server yourself, precompiled binaries are available for many Unix platforms. If there is no precompiled version for your platform, of if it doesn't work (e.g. the name resolution doesn't work), you should get the source code and compile it yourself. There is special instructions if you are installing under VMS.


  1. Uncompress and untar the distribution tar files:
            uncompress w3c-httpd-3.0A.tar.Z
            tar xvf w3c-httpd-3.0A.tar.Z
  2. The compilation and linking of the server is done using the BUILD script which figures out what platform you are using. If you have build earlier versions of the W3C software and you already have a WWW directory then it is very important that you do the following:
    	cd WWW
    	make clobber

    in order to make sure that all new code is built. If not then go to newly-created WWW directory, and give command the ./BUILD daemon:

            cd WWW
  3. Executable httpd appears in directory ../WWW/Daemon/sun4 (if you have a Sun4 machine), or in another subdirectory corresponding to your machine architecture. The utility programs go to the same directory (htadm, htimage, cgiparse and cgiutils).

Configuration File

If you have all your documents in a single directory tree, say /Public/Web, the easiest way to make them available to the world is to specify the following rule in your configuration file:

        Pass	/*	/Public/Web/*

This maps all the requests under the directory /Public/Web and accepts them.

The default welcome document (what you get with URL of form http://your.host/) is now Welcome.html in the directory /Public/Web.

First Trying It Out In Verbose Mode

Often it is easy to make mistakes in the configuration file that makes configuring httpd feel tedious - this doesn't have to be so. In the beginning start httpd by hand in verbose mode to listen to some port, and look what happens when you make a request to that port with your browser.

Typically test servers are run on a non-priviledged port above 1024 (you don't have to be root to bind to them), often 8001, 8080, or such. Official HTTP port is 80.

The server port is defined in the configuration file with the Port directive, but you can override it with the -p command line option while testing; e.g.

        httpd -v -r /home/you/httpd.conf -p 8080

This will start httpd in verbose mode, use configuration file httpd.conf in your home directory, and accept connections to port 8080.

You can now try to request a document from your server using a URL of form:


where document.html is relative to the directory that you have exported in your configuration file. If you get an error message back see the verbose output to find out what is going wrong - it is usually self-explanatory.

The Actual Installation of httpd

In Unix you can run the server either as stand-alone, or from Internet Daemon (inetd). A stand-alone server is typically started once at system-boot time. It waits for incoming connections, and forks itself to serve a request. This is much faster than letting inetd spawn httpd every time a request comes.

We strongly recommend that you run W3C httpd in stand-alone mode.

Stand-alone Installation

A stand-alone server is started from the bootstrap command file (for example /etc/rc.local) so that it runs continuously like the sendmail daemon, for example.

This method has the advantage over using the inetd that the response time is reduced.

Add a line starting httpd to your system startup file (usually /etc/rc.local or /etc/rc). If you have the configuration file in the default place, /etc/httpd.conf, and if it specifies the port to listen to via the Port directive, you don't need any command line options:

    /usr/etc/httpd &

httpd will automatically go background so there is really no need for an ampersand in the end (as long as your configuration file /etc/httpd.conf really exists).

Or a little more safely in case httpd is removed:

    if [ -f /usr/etc/httpd ]; then
        (/usr/etc/httpd  && (echo -n ' httpd') ) & >/dev/console

Naturally you can use any of the command line options, if necessary.

Registering Your Server

Once you have your httpd up and running, and you have documents to show the world, announce your server, so that others can find it.

If It Doesn't Work...

...first run it in verbose mode with the -v option and try to figure out what goes wrong. See also the debugging chart, the FAQ, and the Known Bugs pages. If you can't figure out what's going wrong, feel free to send mail to httpd@w3.org

Henrik Frystyk Nielsen, httpd@w3.org,

@(#) $Id: Installation.html,v 1.14 1998/08/11 13:43:20 connolly Exp $