Configuration File Examples

A basic configuration file for httpd might look like this:
        Pass    /          file:/u/john/welcome.html
        Pass    /*         file:/u/john/public/*
        Fail    *
The first line maps the root document onto a specific document about the server, and accepts it. (See etiquette about the welcome page.)

The second line maps all document names onto filenames in a particular directory and accepts them.

The third line disallows access to all other documents. (This is actually no longer necessary, because httpd by default fails everything that isn't explicitely Pass'ed.


Second Example

        UserDir  public_html
        Exec     /htbin/*     /u/john/scripts/*
        Map      /            /tnotes/welcome.html
        Map      /tnotes/*    file:/u/john/public/*
        Map      /seminars/*  file:/u/jane/seminars/*
        Pass     file:/u/john/public/*
        Pass     file:/u/jane/seminars/*.html
The first line specifies that user-supported directories are called public_html under each user's home directory. This is where URLs of form /~username/... get mapped.

The second line specifies that all the starting with /htbin/ will be handled as requests to run a server script in directory /u/john/scripts. It's important to have the Exec rule before Maps and Passes, to avoid script requests from being served as regular file requests.

The first Map rule maps the root document onto a specific document about the server. Because it is Map and not Pass, it doesn't accept it but passes it on for futher mapping by lines futher down.

The second Map rule maps all document names starting with /tnote/ onto filenames in a particular directory where john maintains the technical notes. If someone else takes over the technical notes, we can change this. Here we are starting to distinguish between document names and file names. This can be carried much further if necessary, but one level of mapping is enough to allow for changes of administration of different areas.

The third Map separately maps the seminar information into Jane's seminars directory.

The Pass rules enable access to anything in John's public directory, and any .html file in Jane's seminar directory tree. Note here that the * maps to any sequence including slashes so all files in any subdirectory of /u/jane/seminars will be enabled so long as they end in .html.

Remember that currently the wildcard character can only appear once.

IMPORTANT: It is important to understand that rules are translated from top to bottom, and the first Pass, Exec or Fail rule that matches the current template will terminate rule translation.


Configuration file for a WAIS gateway

httpd can be used as a WAIS gateay if it has been compiled with the necessary options and linked with the freeWAIS software. A suitable configuration file is
        Pass    /*   wais://*


httpd@info.cern.ch