The Backing Server

Currently phhttpd is not a full implementation of a web server. It only performs a small portion of the work that a web server must do. Namely, it handles the static content that it can serve very quickly. More complicated work, like serving dynamic content, is left to another web server on the system.

As phhttpd is starting up, it listens on a Unix domain socket for the other web server to establish a connection. This socket is specified by the 'tunnel' tag in the config file. When a connection is established, the backing web server gives phhttpd a list of the sockets that it must listen on to serve all the content the backing server knows about. Note that it is very important that phhttpd be configured with virtual servers that cover these sockets. See the configuration section of this manual.

With this information, phhttpd continues happily on its way. When a request comes in it decides if it can service the request. If it can't, it passes the request over the connected Unix domain socket to the waiting web server. After this point phhttpd has nothing to do with the serving operation.

Notice that this means that one must start phhttpd before the backing server, and they must always be shutdown and started in lockstep. phhttpd will not serve data until it has heard from its backing server.

This setup relies on the backing server being aware of phhttpd. It must know how to pass its listening socket information to phhttpd, and must wait for new connections over the Unix domain socket rather than listening on its sockets directly. Currently the only server that has such capability is an appropriately patched apache. In Apache's case, a 'Tunnel path' line must be added to its configuration files in a global syntax for it to talk with phhttpd. If this tag is left out, apache will behave as normal.