Actually to build a apache module is not very hard if you can find a nice way to do it. Here I want to show you my way.
To build a apache module you have to install two things:
- Apache http server
- APR(apache portable runtime)
Nothing much to describe How to install these, Just apt-get install!!(Debian)
if you have successfuly installed these two kinds of thing above, you can use the following command to automatically build a module sample
Now you can see a mod_foo.c and a Makefile in your working dirtectroy. Next!
To play with this sample module first compile it into a DSO file and install it into Apache’s modules directory by running:
Then activate it in Apache’s apache2.conf file for instance for the URL /foo in as follows:
Then after restarting Apache via
you immediately can request the URL /foo and watch for the output of this module. This can be achieved for instance via:
The output should be similar to the following one:
More infomation: Looking at 《The Apache Module Book》you can find a pdf version on the internet.