README revision 0f081398cf0eef8cc7c66a535d450110a92dc8ae
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuREADME for Apache 1.2 Example Module
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuThe files in the src/modules/example directory under the Apache
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescudistribution directory tree are provided as an example to those that
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescuwish to write modules that use the Apache API.
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuThe main file is mod_example.c, which illustrates all the different
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescucallback mechanisms and call syntaces. By no means does an add-on
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescumodule need to include routines for all of the callbacks - quite the
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuThe example module is an actual working module. If you link it into
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescuyour server, enable the "example-handler" handler for a location, and then
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescubrowse to that location, you will see a display of some of the tracing
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescuthe example module did as the various callbacks were made.
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuTo include the example module in your server, follow the steps below:
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu 1. Uncomment the "Module example_module" line near the bottom of
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu the src/Configuration file. If there isn't one, add it; it
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu should look like this:
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu Module example_module modules/example/mod_example.o
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu 2. Run the src/Configure script ("cd src; ./Configure"). This will
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu build the Makefile for the server itself, and update the
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu src/modules/Makefile for any additional modules you have
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu requested from beneath that subdirectory.
a77aecc59cee605ea48e33b65a627e0aa0a245e0Mihai Codescu 3. Make the server (run "make" in the src directory).
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuTo add another module of your own:
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu B. cp src/modules/example/* src/modules/mymodule
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu C. Modify the files in the new directory
a9cc955b0a33e631b9ce3404e4e25b62cd067a77Christian Maeder D. Follow steps [1] through [3] above, with appropriate changes.
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuTo activate the example module, include a block similar to the
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescufollowing in your srm.conf file:
a9cc955b0a33e631b9ce3404e4e25b62cd067a77Christian Maeder <Location /example-info>
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescu SetHandler example-handler
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuAs an alternative, you can put the following into a .htaccess file and
a9cc955b0a33e631b9ce3404e4e25b62cd067a77Christian Maederthen request the file "test.example" from that location:
a9cc955b0a33e631b9ce3404e4e25b62cd067a77Christian Maeder AddHandler example-handler .example
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai CodescuAfter reloading/restarting your server, you should be able to browse
2e0e43889f746e31eacf8eeccdeaa4032a65b07eMihai Codescuto this location and see the brief display mentioned earlier.