1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
8 <title>mod_example - Apache HTTP Server</title>
9 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
14 <div id="page-header">
15 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
16 <p class="apache">Apache HTTP Server Version 2.0</p>
17 <img alt="" src="../images/feather.gif" /></div>
18 <div class="up"><a href="./"><img title="<-" alt="<-" src="../images/left.gif" /></a></div>
20 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.0</a> > <a href="./">Modules</a></div>
21 <div id="page-content">
22 <div id="preamble"><h1>Apache Module mod_example</h1>
24 <p><span>Available Languages: </span><a href="../en/mod/mod_example.html" title="English"> en </a> |
25 <a href="../ko/mod/mod_example.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
27 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Illustrates the Apache module API</td></tr>
28 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
29 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>example_module</td></tr>
30 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_example.c</td></tr></table>
34 This document has not been updated
35 to take into account changes made in the 2.0 version of the
36 Apache HTTP Server. Some of the information may still be
37 relevant, but please use it with care.
40 <p>The files in the <code>src/modules/example directory</code>
41 under the Apache distribution directory tree are provided as an
42 example to those that wish to write modules that use the Apache
45 <p>The main file is <code>mod_example.c</code>, which
46 illustrates all the different callback mechanisms and call
47 syntaxes. By no means does an add-on module need to include
48 routines for all of the callbacks - quite the contrary!</p>
50 <p>The example module is an actual working module. If you link
51 it into your server, enable the "example-handler" handler for a
52 location, and then browse to that location, you will see a
53 display of some of the tracing the example module did as the
54 various callbacks were made.</p>
56 <div id="quickview"><h3 class="directives">Directives</h3>
58 <li><img alt="" src="../images/down.gif" /> <a href="#example">Example</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#compiling">Compiling the example module</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#using">Using the <code>mod_example</code> Module</a></li>
65 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
67 <h2><a name="compiling" id="compiling">Compiling the example module</a></h2>
69 <p>To include the example module in your server, follow the
74 Uncomment the "AddModule modules/example/mod_example" line
75 near the bottom of the <code>src/Configuration</code> file.
76 If there isn't one, add it; it should look like this:
77 <div class="example"><p><code>
78 AddModule modules/example/mod_example.o
82 <li>Run the <code>src/Configure</code> script
83 ("<code>cd src; ./Configure</code>"). This will
84 build the Makefile for the server itself, and update the
85 <code>src/modules/Makefile</code> for any additional modules
86 you have requested from beneath that subdirectory.</li>
88 <li>Make the server (run "<code>make</code>" in the
89 <code>src</code> directory).</li>
92 <p>To add another module of your own:</p>
95 <li><code>mkdir src/modules/<em>mymodule</em></code></li>
97 <li><code>cp src/modules/example/*
98 src/modules/<em>mymodule</em></code></li>
100 <li>Modify the files in the new directory.</li>
102 <li>Follow steps [1] through [3] above, with appropriate
105 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
106 <div class="section">
107 <h2><a name="using" id="using">Using the <code>mod_example</code> Module</a></h2>
109 <p>To activate the example module, include a block similar to
110 the following in your <code>srm.conf</code> file:</p>
111 <div class="example"><p><code>
112 <Location /example-info><br />
113 SetHandler example-handler<br />
117 <p>As an alternative, you can put the following into a <a href="core.html#accessfilename"><code>.htaccess</code></a> file
118 and then request the file "test.example" from that location:</p>
119 <div class="example"><p><code>
120 AddHandler example-handler .example
123 <p>After reloading/restarting your server, you should be able
124 to browse to this location and see the brief display mentioned
127 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
128 <div class="directive-section"><h2><a name="Example" id="Example">Example</a> <a name="example" id="example">Directive</a></h2>
129 <table class="directive">
130 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Demonstration directive to illustrate the Apache module
132 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Example</code></td></tr>
133 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
134 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Experimental</td></tr>
135 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_example</td></tr>
137 <p>The <code class="directive">Example</code> directive just sets a demonstration
138 flag which the example module's content handler displays. It
139 takes no arguments. If you browse to an URL to which the
140 example content-handler applies, you will get a display of the
141 routines within the module and how and in what order they were
142 called to service the document request. The effect of this
143 directive one can observe under the point "<code>Example
144 directive declared here: YES/NO</code>".</p>
148 <div class="bottomlang">
149 <p><span>Available Languages: </span><a href="../en/mod/mod_example.html" title="English"> en </a> |
150 <a href="../ko/mod/mod_example.html" hreflang="ko" rel="alternate" title="Korean"> ko </a></p>
151 </div><div id="footer">
152 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
153 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="../faq/">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div>