Team LiB
Previous Section Next Section

Chapter 17: Web Server Troubleshooting

The Apache web server is the most popular web server software in the world. It is provided by default as part of the server installation of Fedora Core, and most other Linux distribution today. Whether you serve thousands of virtual hosts offering completely dynamic content or a single site serving only static files, you can configure Apache to suit your needs.

In this chapter, we introduce the features new to the Apache 2.0 release. We show you the basics of Apache configuration, and offer some tricks culled from the best practices of professional web administrators. Finally, we provide some resources for further study, should you be interested in delving into the inner workings of the server.

Apache 2.0: An Overview

Although millions of websites are still hosted successfully on Apache 1.3 and earlier, Fedora Core supplies Apache 2.0, first released in 2001. The 2.0 version brought significant changes to Apache installations, including improvements in security, process management, and administrative ease. This section describes some of these improvements in detail.

Tip 

There are a few reasons to run Apache 1.3 on your Fedora Core machine (such as some needed module compatibility). However, this is not a concern for most people. We offer some tips on making the transition from 1.x to 2.0 in the Migrating from Apache 1.x to 2.0 section later.

UNIX Threading

Apache can take full advantage of POSIX threads support on UNIX systems to improve scalability. Unfortunately, this feature is not fully implemented in the Apache package included with the current version of Fedora Core, which is based on an older version of Apache optimized for stability when serving dynamic content.

Tip 

The Fedora Core Apache package can be recompiled to take advantage of the POSIX threads option, though in a limited implementation. See the MPM links in Table 17-2, and look at the "worker" MPM if you need fully implemented threads capability. Just be aware that use of the "worker" MPM is less stable and less compatible with some modules (for example, PHP).

New Build System

The build system in Apache 2.0 was completely rewritten and is now based on autoconf and libtool. This change makes compiling Apache more like working with other Linux packages than it used to be. This change does not affect Fedora Core users who use the default binary RPMs included with the Fedora Core distribution, but if you want to compile Apache from scratch, you'll find that the procedure for 2.0 is different than it was for Apache 1.x versions.

Tip 

Whenever recompiling packages from source on any Red Hat-based system, try to use source RPMs instead of less regulated tarball methods. By keeping your system on RPM, you maintain more flexibility and control over things like patching and revision-related packages.

Multiprotocol Support

Apache now has infrastructure that allows it to support serving multiple protocols, that is, protocols other than HTTP. For example, the mod_2echo module embeds a server that echoes whatever is sent to it, using this multiprotocol support.

Better Support for Non-UNIX Platforms

Apache 2.0 is faster and more stable than Apache 1.x on non-UNIX platforms. While this is not particularly important for those running UNIX- or Linux-only networks, those readers who administer multi-OS networks will find Apache 2.0 to be far more reliable on other operating systems since it is now implemented in native APIs for almost all platforms in general use.

New Apache API

The API for Apache modules has changed significantly under Apache 2.0. Most modules written for Apache 1.3 will not work under 2.0. The good news is that if you've been experiencing module ordering or priority problems under 1.x the API used for 2.0 modules will solve those issues.

Caution 

If you upgrade your Apache installation from 1.x to 2.0, you will probably need to download new 2.0 versions of all your installed modules. Although a given module may have the same name under each version, only the 2.0 modules will run reliably under the new server version.

IPv6 Support

Apache now gets IPv6 listening sockets by default on systems where IPv6 is supported by the Apache Portable Runtime library. Certain Apache directives, including Listen and NameVirtualHost, can now take numeric address strings.

Filtering

Apache now permits the use of modules that filter a stream of content as it travels past the web server. This may speed up your server's response. For example, the mod_include module checks file content before it is delivered to the client and parses it for Server Side Include directives, using the INCLUDES. You might also be interested in the mod_ext_filter module, which allows external programs to act as filters.

Multilanguage Error Responses

Error messages can be sent to the browser in multiple languages, depending on the Server Side Include documents called by the requesting browser. This may be of particular interest to those who administer sites that contain documents in different character sets.

Simplified Configuration

Many directives are easier to understand under 2.0 version than they were under Apache 1.x. For example, the Port and BindAddress directives have been removed and the Listen directive is now the only one used to bind IP addresses.

Separate Configuration Files for Apache Applications

Beginning with Apache 2.0, any file ending with the .conf suffix and located in /etc/httpd/conf.d will automatically be processed as if it were part of the main configuration file. This allows the administrator to separate configuration files for easier editing. This feature is intended to simplify configuration of Apache modules and helper programs. For example, /etc/httpd/conf/perl.conf can be used to configure the mod_perl module, /etc/httpd/conf/php.conf for PHP, and so on.

Updated Regular Expression Library

In order to take advantage of Perl 5's more powerful regular expression syntax, Apache 2.0 includes the Perl Compatible Regular Expression library, or PCRE. All Apache 2.0 regexp evaluation now follows Perl 5 syntax.


Team LiB
Previous Section Next Section