LoadModule. The LoadModule directive lets you load modules. (You might not work much with modules at first, but you need to know how to load them and how to stop them from loading.) The directive's syntax is as follows:
LoadModule module_identifier relative_path_to_module_file
where module_identifier is a string that identifies the module to the LoadModule directive and relative_path_to_module_file is the path to the module file, relative to the Apache installation directory. For example, to load the WebDAV module mod_dav, configure the directive as follows:
LoadModule dav_module modules/mod_dav.so
The Apache documentation specifies each module's identifier, but a good rule of thumb is that the identifier is the end of the module name (i.e., the portion following "mod_") followed by "_module." For example, the identifier dav_module corresponds with the module mod_dav. Note that Apache module filenames end with the .so extension, which Linux systems use to denote a shared library file (similar to the .dll extension in Windows systems). Apache uses the extension across platforms for consistency and to minimize conflicts within the Apache documentation.
ThreadsPerChild and MaxRequestsPerChild. The ThreadsPerChild directive specifies how many threads a child process can create. (Each thread can service one connection.) If you set this value to 50, for example, your Web server can handle only 50 client connections at a time. Therefore, ensure that this value is set properly for your environment.
The MaxRequestsPerChild directive specifies how many connections a child process can handle before the Apache parent process kills the child process and creates a new child process. You can use this directive to limit a process's life and thus minimize memory-leak problems (when using an experimental module, for example). You can set the directive to 0 to turn it off so that the child process doesn't terminate automatically after a certain number of connections.
For example, to permit each child process to create as many as 250 threads (so that Apache can handle 250 connections simultaneously) and to prevent the parent process from killing and restarting the child process after a certain number of connections, configure the directives as Listing 1 shows. Note that in this example, the ThreadsPerChild and MaxRequestsPerChild directives are enclosed in an <IfModule> block, in which the <IfModule> directive specifies the winnt MPM. Some directives work only when you've loaded certain modules. To determine whether a module is loaded and to apply applicable directives if it is, Apache lets you use the <IfModule> directive to enclose the directives within a block, as Listing 1 shows. (If you'll always be using the winnt MPM, you can remove the <IfModule> directive to always specify ThreadsPerChild and MaxRequestsPerChild.) Note that you must append the .c extension to the module name. (You might wonder why <IfModule> uses .c and <LoadModule> uses .so when specifying modules. The <IfModule> directive uses the module name that module developers embed in each module file and that ends in a .c, whereas <LoadModule> loads a file from the file system; this file ends in .so.)
Other types of directives let you apply a scope to configuration parameters. For example, when you want to create a virtual host (as the sidebar "Using Apache to Create Virtual Hosts" explains), you can use the <VirtualHost> block to specify directives specific to that virtual host, as Listing 2 shows. (To find out more about applying scopes to a set of directives, visit http://httpd.apache.org/docs-2.0/sections.html.) You might also want to learn more about some of the more arcane but useful directives, such as the mod_rewrite module's Rewrite directive, which lets you rewrite the URL that a user specifies. I suggest that you adjust and test various values in the configuration file as you work with Apache. Apache has long had a reputation for incredible flexibility, so be sure to maximize this flexibility for your benefit.
After you make any changes to the Apache configuration file, restart Apache. To do so, use the Apache Control icon or the tools provided in the Start menu's Apache program.
Take the Advantage
Apache is an incredible tool that has proven to be both flexible and reliablea difficult task. And now that the product can scale on any supported platform, you can use this flexibility and reliability to your advantage under Win2K. Test Web sites that use static pages, then progress to CGI scripts and even server-side scripting such as PHP Hypertext Preprocessor (PHP). After you see the many advantages to running Apache on your Windows servers, you'll be hard pressed to find a reason not to use Apache in your production environment.
End of Article