26 Oct
I need to write an apache module and looked around for a quick start on how to get started developing apache modules under ubuntu. I didn’t find anything 1,2,3, so here’s what I came up with:
- sudo apt-get install apache2-prefork-dev
- mkdir ~/mod_example && cd ~/mod_example
- wget -O mod_example.c “http://svn.apache.org/viewvc/httpd/httpd/tags/2.2.14/modules/experimental/mod_example.c?revision=818301&view=co ( adjust as necessary for your version of httpd )
- sudo apxs2 -c -i mod_example.c ( this builds and installs the module. )
- sudo su
- echo “LoadModule example_module /usr/lib/apache2/modules/mod_example.so” > /etc/apache2/mods-available/example.load
- vi /etc/apache2/mods-available/example.conf Paste the following:
<Location /example-info> SetHandler example-handler </Location>
- cd /etc/apache2/mods-enabled && ln -s ../mods-available/example.* .
- service apache2 restart
To test, browse to http://localhost/example-info.
References:
