Chapter 8:  Modules


Stronghold uses a modular architecture that consists of a core Apache server enhanced by a number of modules. Each module implements a different feature set, and you can add, remove, enable, or disable modules to change the total feature set of your server.

This chapter explains

Since Stronghold's resource requirements are directly proportional to the size of the binary, you may want to pare the server down by removing modules you don't need. You can find out which modules are active in at any time by accessing the server information report described in "Server Information Reports" on page 1-13, or by using the -l flag with the httpsd command:

# httpd -l

In addition to the modules bundled with Stronghold, many third-party modules are available through the Apache Module Registry at http://modules.apache.org/ Apache modules are compatible with Stronghold. If you are interested in writing your own modules for Stronghold, consult the Apache API Notes at http://www.apache.org/docs/API.html

Stronghold Modules

Each of Stronghold's modules supports a discrete feature set, and most modules utilize configuration directives. In Chapter 3, each directive entry specifies the module associated with that directive. You can only use a directive if its supporting module is active. If you remove a module, be sure to comment out its directives in httpd.conf, or use <IfModule> to exclude it dynamically as described in "Containers" on page 6-2.

The following modules are bundled with Stronghold, though not all are compiled in by default:

Module Default? Description

mod_access

3

Provides host-based access using the allow, deny, and order directives

mod_actions

3

Executes scripts based on the file type of the requested document, using the Action and Script directives

mod_alias

3

Provides file and directory aliasing and redirection

mod_asis

3

Allows .asis files when httpsd.conf includes this line:

AddType httpd/send-as-is asis

mod_auth

3

Conducts basic authentication

mod_auth_anon

 

Allows anonymous logins

mod_auth_db

 

Provides user authentication using Berkeley DB files

mod_auth_dbm

3

Provides user authentication using DBM files

mod_auth_msql


Provides client authentication using an mSQL database

mod_autoindex

3

Generates directory indices on the fly

mod_browser


Sets environment variables based on the browser used for the current request

mod_cern_meta

3

Allows CERN-compatible metainformation files

mod_cgi

3

The Common Gateway Interface, which executes external programs and returns their output to clients. CGI is explained in detail in Chapter 10, "Common Gateway Interface".

mod_digest

 

Performs HTTP Digest authentication

mod_dir

3

Sets the default file to return when the requested URL specifies a directory but not a file

mod_ecash

 

Facilitates online commerce with clients that support Ecash (US version only)

mod_env

3

Passes environment variables to CGI programs

mod_expires

3

Applies an Expires HTTP header field to resources

mod_fastcgi


FastCGI

mod_headers

3

Generates arbitrary HTTP response headers

mod_imap

3

Processes server-side imagemaps

mod_include

3

Parses server-side includes

mod_info

3

Generates HTML-based server information pages showing the current configuration

mod_log_agent

3

Logs user agents for NCSA compatibility. However, we recommend using mod_log_config and the CustomLog directive for this purpose.

mod_log_config

3

Formats the transfer log according to the LogFormat directive

mod_log_referer

3

Logs referers for NCSA compatibility. However, we recommend using mod_log_config and the CustomLog directive for this purpose.

mod_mime

3

Maps filenames to MIME types

mod_mime_magic

 

Maps file structures to MIME types

mod_mmap_static


An experimental module that maps files into memory on startup of restart--not recommended; except for expert users

mod_negotiation

3

Performs content negotiation

mod_php

3

Provides HTML-embedded, server-side scripting controlled by the directives in "PHP/FI 2.0 Embedded Scripting" on page 7-93. PHP is explained in detail in Chapter 11, "PHP3 Embedded Scripting.".

mod_proxy

3

Performs proxying and caching

mod_rewrite

3

Maps URIs to filenames using rewrite rules

mod_setenvif

3

Sets environment variables conditionally based on regular expression matching

mod_so

 

Loads shared object files on startup or restart; see "Dynamic Shared Object Support" on page 8-6

mod_speling

 

Performs spell-checking on failed URLs

mod_ssl

3

Performs SSL/TLS authentication and encryption

mod_status

3

Generates HTML-based server status reports showing current server activity

mod_sxnet

3

Provides support for Thawte Stronghold Extranet user authentication. See
http://www.thawte.com/certs/strongextranet/ for more details

mod_statisgraph


An experimental module

mod_unique_id

 

Assigns a unique identifier to each request and stores it in an environment variable

mod_userdir

3

Enables user Web directories

mod_usertrack

3

Performs session tracking with Netscape cookies

Before you decide to remove one of these modules, be sure you know how its absence affects Stronghold's functionality. For example, you can safely remove mod_status if you are not interested in real-time, HTML-formatted status reports. Removing mod_ssl, however, is not recommended because any HTTPS request will fail.

Adding and Removing Modules

Stronghold Web Server 3.0 provides three different methods of adding and removing modules:

Dynamic Shared Object Support

Dynamic shared object (DSO) support allows the server to load modules at startup instead of having them compiled into the server binary. DSO is supported by mod_so, which must be compiled in statically. When mod_so and the server core are compiled statically, they can load other modules at startup that are designated in httpd.conf. DSO support also allows multiple instances of the server to run with different module sets configured with different httpd.conf files.

Although DSO provides a convenient way to add and remove modules quickly, dynamically loaded modules do not perform as efficiently as statically compiled modules. It is recommended that all necessary modules be compiled statically, and that only new, temporary, or seldom-used modules be loaded dynamically.

In order to use DSO support, you must;

To set up DSO support


The mod_so module cannot be loaded dynamically; it must be compiled in statically.

The modules designated with SharedModule are now available as shared object files. Before you start the server again (with the <ServerRoot>/bin/start-server script), you must edit httpd.conf and specify the shared object files that the server will load on startup.

To enable or disable modules with DSO support

Dynamic Module Linking

Stronghold's dynamic module linking system allows you to change the set of active modules without recompiling the server, provided that all the modules you want to use are already compiled. You can use this feature to streamline Stronghold's feature set, but you cannot use it to add modules that are not already compiled. For example, you could recompile Stronghold with all available modules, then use dynamic module linking to narrow down the number of modules that Stronghold actually uses.

The list of modules that are currently compiled is the default list of "active" modules. Dynamic linking first "clears" this list, then applies a new list that Stronghold reads from the httpd.conf file each time it starts. This simplifies module configuration, because you only need to edit httpd.conf and restart Stronghold to implement module changes.

To link modules dynamically

If you want to remove an active module, simply delete it from the AddModule list and restart Stronghold. Likewise, you can add modules to the list at any time, then restart Stronghold to implement them.

Recompiling Stronghold

The Configuration file already contains the code you need to install any module that comes with Stronghold, including the optional modules described later in this chapter. The precompiled modules described on page 8-3 are compiled into Stronghold when you first install it. Optional modules are commented out of Configuration. By uncommenting a line of module code, you can recompile the server to include that module. Commenting out a line of module code and recompiling the server excludes the module.

If you want to reconfigure the PHP module for database support, you must follow the instructions in "Recompiling The PHP Modules" on page 11-3, then recompile Stronghold as described in this section.

The order of the module list in Configuration affects how the modules are compiled. In general, use these guidelines for dealing with the module list:

Many third-party modules have not been thoroughly tested for use with Stronghold 3.0 and Apache 1.3.1. If you have an existing server with third-party modules that you wish to compile into Stronghold 3.0, do so with caution. When using an existing Configuration file or modifying the new Configuration file to include new modules, note these changes:

To edit Configure and recompile Stronghold