Installation

For purposes of demonstration, in the subsequent sections, it will be assumed that Apache is installed under /home/httpd/apache, and that sources will be extracted under /usr/local/src. Currently, mod_snake is only supported as a DSO under Apache 2.0. Under Apache 1.3 it is supported both as a DSO and statically built in.

Existing Apache Installation with DSO Support

Apache has the ability to load shared modules on the fly. These are called Dynamically Shared Objects (DSO). Mod Snake can be installed into an existing Apache installation which has DSO support with very little work. To check if Apache was built with DSO support, execute the following command:

bash$ /home/httpd/apache/bin/httpd -l | grep mod_so.c

If mod_so.c is returned as output, Apache contains DSO support. If not, see the section called Building Apache with Mod Snake Support

To install mod_snake, the following steps can be taken:

  1. Download mod_snake from modsnake.sourceforge.net.

  2. Extract, configure, and install mod_snake.
    bash$ gunzip -c mod_snake-0.5.0.tar.gz | tar -xvf -
    bash$ cd mod_snake-0.5.0
    bash$ ./configure --with-apxs=/home/httpd/apache/bin/apxs
    bash$ make install

  3. Test the server. See the section called Quick Test.

  4. All done!

Building Apache with Mod Snake Support

  1. Download Apache from www.apache.org

  2. For Apache 1.3 builds, extract, configure, and build Apache:

    bash$ gunzip -c apache_1.3.17.tar.gz | tar -xvf -
    bash$ cd apache_1.3.17
    bash$ ./configure --prefix=/home/httpd/apache --enable-module=so
    bash$ make

  3. For Apache 2.0 builds, extract, configure, and build Apache:

    bash$ gunzip -c apache_2.0a9.tar.gz | tar -xvf -
    bash$ cd apache_2.0a9
    bash$ ./configure --enable-so --prefix=/home/httpd/apache
    bash$ make

  4. If a DSO build is desired, or Apache 2.0 is being used, execute make install, and skip to the section called Existing Apache Installation with DSO Support.

  5. Extract, configure, and install mod_snake:

    bash$ gunzip -c mod_snake-0.5.0.tar.gz | tar -xvf -
    bash$ cd mod_snake-0.5.0
    bash$ ./configure --with-apache=/usr/local/src/apache_1.3.17 --disable-dso
    bash$ make install

  6. Finally, reconfigure, build, and install Apache:

    bash$ cd /usr/local/src/apache_1.3.17
    bash$ ./configure --activate-module=src/modules/mod_snake/libmod_snake.a
    bash$ make install

Mod_Snake Configuration

Aside from needing to load mod_snake into Apache, other optional mod_snake libraries can be installed. These standard libraries add a lot of functionality, such as embedded Python and accelerated CGIs.

bash$ cd /usr/local/src/mod_snake-0.5.0
bash$ mkdir /home/httpd/mod_snake
bash$ cp -R snake_lib examples /home/httpd/mod_snake

The following lines can be appended to the httpd.conf file:

SnakeModuleDir /home/httpd/mod_snake/snake_lib
SnakeModuleDir /home/httpd/mod_snake/examples

These directives tell mod_snake to look in those directories for modules to load. To then load a module from either of those directories (e.g. SnakeLib's SnakeEPy embedded Python processor), the following directive can be added:

SnakeModule mod_snake_epy.SnakeEPy

This loads in the SnakeEPy module, and gives more directives that can be placed in the configuration file. To enable embedded Python processing for the main server, the following directives can be used:

SnakeEPy on

Other PyMods can be added and configured in similar ways. See the documentation for the individual PyMods, or look at the mod_snake_api documentation for the SnakeLib hooks. For more information about the directives, see the section called Mod Snake Configuration Directives

Quick Test

To quickly test to ensure that everything is working correctly, the following lines can be added to the server configuration file (httpd.conf):
SnakeModuleDir /usr/local/src/mod_snake-0.5.0/examples/tut
SnakeModule 01_hello_world.Hello_World

Connect to the webserver and attempt to retrieve the page ``/hello_world''. If the server responds with a page containing, ``Hello world!'', then everything is working correctly.