4.3. Loading and using the MIME module

Modules: All the various elements of web server functionality are split out into modules. These are shared libraries that the web server loads when instructed to by its configuration file. In turn, the presence of a module causes new commands to be available in the configuration file corresponding to the newly available functionality.

We start by adding lines to the configuration file to load the module and identify the file containing the filename to type mapping.


LoadModule      mime_module     /usr/lib/apache2/mod_mime.so
TypesConfig     /etc/mime.types

The LoadModule command takes two arguments. The second is the filename of the shared library that it needs. It's normally possible to quote the pathname of the module relative to Apache's ServerRoot, often /etc/apache2. But SLES's Apache is built with an un-helpful ServerRoot of /srv/www so we have to use absolute pathnames here. The first argument is the name of the module within that file. Normally you need to consult the documentation to determine what a module's name is.

A list of all the common modules, together with their library file names, module names and brief descriptions is given in Appendix A at the end of these notes.

The TypesConfig command indicates the file that has the correspondences between file name suffixes and MIME content types.

So how does our web server work now? The pages are now presented as HTML.

Syntax summary: Loading modules

LoadModule name library.so

Load the module named name found in the shared library file library.so.

Syntax summary: mime_module

TypesConfig file

This command specifies the name of the file that does the lookup from filename suffix to MIME content type. On a SLES system this file is /etc/mime.types and is installed by the aaa-base package.