2N/A<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
2N/A <
TITLE>Apache module mod_example</
TITLE>
2N/A <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 2N/A <
H1 ALIGN="CENTER">Module mod_example</
h1>
2N/A <
STRONG>is not</
STRONG> compiled in by default. It illustrates many of
2N/A and, when used, demonstrates the manner in which module callbacks are
2N/A triggered by the server.
2N/A Apache distribution directory tree are provided as an example to those
2N/A that wish to write modules that use the Apache API.
2N/A the different callback mechanisms and call syntaxes. By no means does
2N/A an add-on module need to include routines for all of the callbacks -
The example module is an actual working module. If you link it into
your server, enable the "example-handler" handler for a location, and
then browse to that location, you will see a display of
some of the tracing the example module did as the various callbacks
To include the example module in your server, follow the steps below:
it; it should look like this:
("<
SAMP>cd src; /
Configure</
SAMP>"). This will
build the Makefile for the server itself, and update the
have requested from beneath that subdirectory.
<
LI>Make the server (run "<
SAMP>make</
SAMP>" in the <
CODE>src</
CODE>
To add another module of your own:
<
LI><
SAMP>mkdir
src/
modules/<
EM>mymodule</
EM></
SAMP>
<
LI>Modify the files in the new directory.
<
LI>Follow steps [1] through [3] above, with appropriate changes.
Using the <
SAMP>mod_example</
SAMP> Module
To activate the example module, include a block similar to the
following in your <
SAMP>
srm.conf</
SAMP> file:
<Location /example-info>
SetHandler example-handler
As an alternative, you can put the following into a
><
SAMP>.htaccess</
SAMP></
A>
file and then request the file "
test.example" from that
AddHandler example-handler .example
to this location and see the brief display mentioned earlier.
<
LI><
A HREF="#example">Example</
A>
><
STRONG>Syntax:</
STRONG></
A> Example
><
STRONG>Default:</
STRONG></
A> None
><
STRONG>Context:</
STRONG></
A> server config, virtual host, directory,
><
STRONG>Override:</
STRONG></
A> Options
><
STRONG>Status:</
STRONG></
A> Extension
><
STRONG>Module:</
STRONG></
A> mod_example
><
STRONG>Compatibility:</
STRONG></
A> <
SAMP>Example</
SAMP> is only
available in Apache 1.2 and later.
The <
SAMP>Example</
SAMP> directive activates the example module's
for a particular location or file type. It takes no arguments. If
you browse to an URL to which the example content-handler applies, you
will get a display of the routines within the module and how and in
what order they were called to service the document request.