Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


April 2003

Apache 2.0 on Win2K

The popular open-source Web server extends its Windows capabilities
RSS
Subscribe to Windows IT Pro | See More Internet Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!
SideBar    Using Apache to Create Virtual Hosts

Download the Code Here

 See corrections to this article

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 reliable—a 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

   Previous  1  2  [3]  Next  


Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.




Corrections to this Article:

  • In Dustin Puryear's article "Apache 2.0 on Win2K" (April 2003, http://winnetmag.com, InstantDoc ID 38288), the author says that when installing Apache software you need to "first remove or disable any existing IIS installation." Is this a necessary step, and can Apache and Microsoft IIS coexist?
Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

New Microsoft/Yahoo! Deal? No

On Sunday, the Times of London reported that Microsoft had renewed talks with failing Internet giant Yahoo! and would manage its search engine for 10 years, while Yahoo! would retain control of its email, messaging, and content services. This report ...

How can I stop and start services from the command line?

...


Related Events Delivering Reliable and Effective Web-Based Applications

Making Web Application Perform Better: What to Watch, How to Watch It, and How to Fix It

Check out our list of Free Email Newsletters!

IIS and Web Administration eBooks Keeping Your Business Safe from Attack: Monitoring and Managing Your Network Security

Related IIS and Web Administration Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing