March 13, 2011, 10:26 a.m.
posted by jack
Those readers who are accustomed to working with Apache 1.x may find the transition to Apache 2.0 somewhat confusing. While the new version is much more robust and secure, there are some changes which you'll need to know about before you start performing your habitual tasks.
One common problem for 1.x administrators involves Apache 2.0's added security. By default, Apache now displays a standardized error page when a request is made for a nonexistent page. The document root OptionIndexes is disabled, even for virtual hosts and for / (each site's own document root). This means that a new VirtualHosts entry with no index.html file will display the default error page, which looks like the old server default index.html file. While this prevents malicious users from browsing part of your web server's file system by hitting a site with no index file, it can be annoying, especially if you're trying to just set up an HTTP-based file share.
When moving or migrating between Apache 1.x systems and 2.x systems, as noted earlier in this chapter, the Apache RPM base package name is no longer apache with 2.0. Instead, it's httpd. Use these commands to search for both package names on a newer system:
# rpm -qa|grep apache # rpm -qa|grep httpd httpd-devel-2.0.46-25.ent httpd-2.0.46-25.ent
Another area for confusion is the DirectoryIndex directive. Under Apache 2.0, the default number of DirectoryIndex file types (that is, the number of web page filenames and extensions that are considered the home page for a directory) is less than what it was under 1.x. Where there used to be five to seven supported file types, the default is now only two. To change this setting, look for the following line in httpd.conf:
DirectoryIndex index.html index.html.var
If you've migrated from Apache 1.x to 2.0 and many of your old pages suddenly stop functioning, then this is probably the reason.
Before you modify the DirectoryIndex defaults, check the new outsourced /etc/httpd/conf.d/ directory to see if the directory index is now being handled by an external configuration file located there. For example, PHP is now handled by /etc/httpd/conf.d/php.conf, Python by /etc/httpd/conf.d/python.conf, and so on.
Finally, when you migrate from Apache 1.x to 2.0, you should copy all your Section 3 VirtualHost blocks from the old httpd.conf file into the new httpd.conf.
Do not copy your old 1.x files into the new 2.0 directories, and do not copy/paste an entire Apache 1.3 configuration contents (Section 1 or Section 2 content) into an Apache 2.0 daemon configuration file. Doing so will break Apache, create multiple migration-related problems, and possibly even require you to wipe and reinstall Apache from scratch.