[Top] [Prev] [Next] [Last]
|
|
Chapter 8Modules
Figure 8-1: Stronghold's Modular Architecture
- Stronghold's modules
By default, most of the included modules are compiled into Stronghold during installation. "Stronghold Modules" on page 8-2 describes each of the modules distributed with Stronghold Web Server and indicates which ones are compiled into the server by default.
- how to add and remove modules
There are several different methods of adding and removing modules from the server. "Adding and Removing Modules" on page 8-5 compares these methods and describes how to use each one.
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:
# httpsd -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 7, 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-3.
The following modules are bundled with Stronghold, though not all are compiled in by default:
Adding and Removing Modules
Stronghold Web Server provides three different methods of adding and removing modules:
Dynamic Shared Object Support
In order to use DSO support, you must
- edit the Configuration file so that the server core is compiled with mod_so and other required modules and modules that should be dynamically loadable are converted to shared object files
- edit the httpd.conf file so that the modules you want to activate are listed for loading at server startup or restart
This can easily be done whenever you want to change the set of dynamically loaded modules.
To set up DSO support
- Switch to the ServerRoot/src/ directory.
- Open the Configuration file using a text editor.
- Make sure the following line is uncommented:
AddModule modules/standard/mod_so.o
This module must be compiled into Stronghold in order to support DSO.
- For each module that you want to be able to load dynamically, change the AddModule directive to SharedModule.
NOTE: The mod_so module cannot be loaded dynamically; it must be compiled in statically.
- In all SharedModules lines, change the .o module filename extension to .so. For example, the following line
SharedModule modules/standard/mod_dir.o
SharedModule modules/standard/mod_dir.so
- Run Configure:
# ./Configure
- Rebuild HTTPSD:
# make
- Stop the server:
# ../bin/stop-server
- Back up the old binary:
# mv ../httpsd ../httpsd-bak
- Install the new binary:
# cp httpsd ..
To enable or disable modules with DSO support
- Open the ServerRoot/conf/httpd.conf file using a text editor.
- In the global server configuration (above all containers in the file), use a LoadModule directive for each module that the server should load at startup.
LoadModule status_module src/modules/mod_status.so
- Use a LoadFile directive for each additional object file to load at startup.
LoadFile src/enreq.so
- Remove modules that should not be loaded at startup either by deleting their LoadModule lines or commenting them out.
- Save the modified server configuration file.
- Restart the server:
# ServerRoot/bin/reload-server
Dynamic Module Linking
To link modules dynamically
- In httpd.conf, add the following line:
ClearModuleList
- Add the AddModule directive, followed by a new list of active modules. For example:
AddModule mod_ssl mod_cgi mod_dir mod_userdir mod_alias
Use the module names as they appear in the ServerRoot/src/Configuration file.
- Save the modified httpd.conf file.
- Switch to the ServerRoot directory.
- Restart Stronghold by stopping and then starting it:
# bin/stop-server
# bin/start-server
NOTE: You must use this method instead of the reload-server script whenever you change the dynamic module list.
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-2 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 13-3, then recompile Stronghold as described in this section.
- Do not change the order of the module list unless you are sure you know what you are doing.
- If you add third-party modules to the list, place them at the bottom of the list, but above mod_ssl.
- Always remove a module by commenting it out rather than deleting it, so that you do not lose its place in the list.
- The source code has been reorganized; modules are now located in subdirectories of a new ServerRoot/src/modules/ directory.
- The Module directive has been changed to AddModule.
- The EXTRA_LFLAGS variable has been changed to EXTRA_LDFLAGS.
- The -DMAXIMUM_DNS definition is now obsolete.
- The -DSERVER_SUBVERSION=\"string\" compile-time option has been replaced with the run-time API call ap_add_version_component().
- The mod_dir module has been divided into mod_dir and mod_autoindex.
- The mod_auth_msql module is no longer included in the distribution.
To edit Configure and recompile Stronghold
- Switch to the ServerRoot/src directory:
# cd ServerRoot/src
NOTE: This is the directory created during installation, and it may vary from the default.
- Edit the Configuration file to reflect which modules or patches you want.
- To add an existing module, uncomment the module code line by removing the opening hash mark (#).
- To add a new module, place it at the end of the module list using the following syntax:
AddModule modules/directory/object.o
- To remove a module, comment it out by adding a hash mark to the beginning of the module code line.
- Save the modified Configuration file.
- To add a patch, use the patch utility to specify the patch you want to install:
# patch -s < patchfile
- Run Configure:
# ./Configure
- Rebuild HTTPSD:
# make
- Stop the server:
# ../bin/stop-server
- Back up the old binary:
# mv ../httpsd ../httpsd-bak
- Install the new binaries:
# cp httpsd ..
- Start the server:
# ../bin/start-server
[Top] [Prev] [Next] [Last]
© 1998 C2Net International
Feedback: stronghold-docs@c2.net![]()