New versions of Apache are released quite frequentlyóthe latest stable and beta versions are available from the Apache Web site along with notifications of bugs fixed and features added. In general, any recent version of Apache should run with an existing configuration, even if it supports new features.
The important exception is that when upgrading from Apache 1.3 to Apache 2; it may be better to transfer custom configuration details from the old httpd.conf to the new. To avoid mixing up custom and default directives, it may be wise to consider using an Include directive to store changes and additions in a different file to the main configuration to make future migrations simpler (this is described in Chapter 4).
Since version 1.3.4, Apache comes with a unified configuration file rather than three individual files. It isnít necessary to merge an existing configuration when upgrading to a later version of Apache 1.3 because the other two files are still looked for. However, Apache 2 removes this feature, so Include directives will be needed to restore the original behavioróthese and other issues are discussed in more detail in Chapter 4.
NOTE Itís not obligatory to upgrade simply because a new release is available. Unless a software bug or security vulnerability has been fixed that specifically applies to your configuration or platform, or a desired feature is now available, the maxim ďif it isnít broken, donít fix itĒ applies. In particular, donít even consider upgrading a production server to a beta release unless itís critical to do so, and even so, use a test server to try the new release first. Itís generally far better to apply a work-around to a known bug than to potentially introduce several unknown ones in order to fix it.
Note that if youíre installing Apache from a binary distribution over an existing installation using install-bindist.sh, the script is intelligent enough to copy the new configuration files with .default extensions, leaving the existing files in place. Once the upgrade is installed, you can restart the server. Unless something unusual has occurred, the new Apache should start up with the old configuration without complaint.
In fact, itís often possible to upgrade Apache just by replacing the existing httpd executable with the new version. However, the new httpd file cannot be copied over the old file if the server is running. Such an attempt would produce an error message such as the following:
Note itís not sufficient to use kill -HUP to restart the server if you intend to run a new binary; this will only cause the running server to perform a restart. To replace it, the server must be actually shut down and restarted using the new executable.
If you choose to just update the binary, be aware that some of the utility programs that come with Apache may cease to work unless you also replace them with new versions; apxs, the utility for compiling modules for Apache, is one thatís likely to break. Other scripts such as apachectl or htpasswd may continue to run but may be improved in newer releases so should probably be upgraded at the same time.
If you installed Apache from a package, you can upgrade it by performing a package upgrade. For example, using the RPM example from earlier, you can simply execute this:
$ rpm -Uvh apache-1.3.28-1.i386.rpm
This will protect existing configuration files where they have changed and install the new ones with an .rpmnew extension. You may then integrate any new configuration changes you like at your leisure. If you also installed packages such as apache-devel or apache-manual (depending on the platform), you should take care to also upgrade these at the same time. This will even serve to upgrade from Apache 1.3 to Apache 2, but there may be more issues to resolve afterward, in particular in relation to changes in Apacheís configuration syntax.
Before moving on to configuring and testing the server, there are few other issues worth considering.
If youíre planning to run an Internet-accessible server, itís a good idea to make sure the serverís clock is accurate so that time-dependent information such as the Expires header, cookies, and log messages (particularly when tracking suspicious activity) is handled correctly.
Given Internet connectivity, the ideal solution is to use a time synchronization protocol and receive accurate time from the Internet. The Network Time Protocol (NTP) is one thatís in widespread use and for which free software is available on many platforms. See http://www.eecis.udel.edu/~ntp/ for more information.
Itís possible to install Apache more than once. There are several reasons why you might want to do this. For example, you might want to separate a secure server using SSL with a restricted set of features from a more capable nonsecure server. Or you might want to run a privileged server with access restrictions independent of the main server. Running a second server is also an excellent way to test a new release in parallel with the current installation before changing it over to the main server.
One way to do this is to invoke install-bindist.sh with different installation roots. A more concise way, at least in terms of disk space consumed, is to use the same installation but use Apacheís -f option to specify alternative server configuration files.
Whatever the reason, as long as the server configurations use different IP addresses and/or ports, thereís no limit to how many different running installations of Apache you may have.
TIP As an alternative, to keep configurations mostly identical, consider using the -D option to enable optional sections of a single configuration.
This chapter is from Pro Apache by Peter Wainwright. (Apress, 2004, ISBN: 1590593006). Check it out at your favorite bookstore today. Buy this book now.