This article introduces those new to networking to Apache, the Hypertext Transfer Protocol (HTTP), and the basics of system administration. It is excerpted from chapter one of Peter Wainwright's book Pro Apache (Apress, 2004; ISBN: 1590593006).
Apache is set up through configuration files in which directives can be written to control Apacheís behavior. Apache supports an impressive number of directives, and each module thatís added to the server provides more.
The approach Apache takes to configuration makes it extremely versatile and gives the administrator comprehensive control over the features and security provided by the server. It gives Apache a major edge over its commercial rivals, which donít offer nearly the same degree of flexibility and extensibility. Itís also one of the reasons for Apacheís slightly steeper learning curve, but the effort is well worth the reward of almost complete control over every aspect of the Web serverís operation.
The drawback to Apacheís versatility is that, unlike other commercial offerings, thereís currently no complete solution for configuring Apache with a Graphical User Interface (GUI) editorófor involved tasks, you must edit the configuration by hand. That said, there are some credible attempts at creating a respectable configuration tool to work with Apacheís power and flexibility. Depending on your requirements, one of these might prove adequate for your needs. More information is available in the ďUsing Graphical Configuration ToolsĒ section in Chapter 2. The drawback is that many configuration tools handle only the most common configuration tasks, so the more advanced your needs become, the more youíll find yourself editing the configuration directly. The fact that youíre editing in a GUI editorís window doesnít alter the fact that the GUI can help you only so much.
Most of this book is concerned with solving problems using Apacheís configuration directives. I introduce the most important ones in Chapter 4 and more advanced ones throughout the rest of the book in the context of the features they provide. However, Iíll also take some time to consider peripheral issues. For example, Chapter 3 covers building Apache from source when you can apply some additional configuration not available at any other time. Chapters 10 and 11 cover Web server security from the point of view of Apache and the server as a whole. This is also a configuration issue, but itís one that extends outside merely configuring Apache.
One of Apacheís greatest strengths is its modular structure. The main Apache executable contains only a core set of features. Everything else is provided by modules (as shown in Figure 1-1), which can either be built into Apache or be loaded dynamically when Apache is run. Apache 2 takes this concept even further, removing platform-specific functionality to MPMs and subdividing monolithic modules such as mod_proxy and mod_cache into core and specific implementation submodules. This allows you to pick and choose precisely the functionality you want. It also provides an extensible architecture for new proxy and cache types.
Consequently, the Web server administrator can choose which modules to include and exclude when building Apache from the source code, and unwanted functionality can be removed. That makes the server smaller, require less memory, and less prone to misconfiguration. Therefore, the server is that much more secure. Conversely, modules not normally included in Apache can be added and enabled to provide extra functionality.
Apache also allows modules to be added so you donít have to rebuild Apache each time you want to add new functionality. Adding a new module involves simply installing it and then restarting the running Apache serverónothing else is necessary. To support added modules, Apache consumes a little more memory than otherwise, and the server starts more slowly because it has to load modules from disk. This is a minor downside but possibly an important one when high performance is a requirement. Additionally, the supplied apxs tool enables you to compile and add new modules from the source code to your server using the same settings that were used to build Apache itself.
Figure 1-1.Apache and module interaction
Thereís a vast array of third-party modules for Apache. Some of Figure 1-1. Apache and module interaction them, such as mod_fastcgi, provide specific additional features of great use in extending Apacheís power. With mod_fastcgi, Apache can cache CGI scripts in a way that makes them respond better to users and consume of fewer system resources.
Other modules provide major increases in power and flexibility. For example, mod_perl integrates a complete Perl interpreter into Apache, allowing it to use the whole range of software available for Perl. Some previously third-party modules have even been added to the Apache 2 distribution as permanent features, notably mod_dav. Probably the biggest new entry, however, is the cornerstone of Secure Sockets Layer (SSL) support in Apacheómod_ssl. This module eliminates a host of inconvenient issues (including the need to patch Apacheís source code) that Web server administrators had to deal with in Apache 1.3.
Itís this flexibility, Apacheís stability and performance, and the availability of its source code that makes it the most popular Web server software on the Internet.
This article is excerpted from Pro Apache by Peter Wainwright (Apress, 2004; ISBN 1590593006). Check it out at your favorite bookstore today. Buy this book now.