Using mod_rewrite and Apache 2
If you want the Apache 2.x that comes with your distro to remain installed then one way to do this is to run the MKDoc Apache on a high port such as 8080 and use mod_rewrite to send requests on port 80 there.
Note that is has advantages: the ‘front-end’ apache-2.x deals with slow-clients and can perform content compression and encryption, this leaves the ‘backend’ apache-1.3 as a dedicated mod_perl server. This backend doesn't need to be compiled with mod_ssl or mod_gzip.
This is an example conf file that could be dropped into /etc/httpd/conf.d/ on a Fedora / RedHat distro:
# Editor: vim:syn=apache
#
# the mkdoc apache is in /usr/local/apache
# and the site is in /var/mkdoc/sites/example.org
#
<VirtualHost *:80>
ServerName www.example.org
ServerAlias example.org
ServerAlias users.example.org
ServerAdmin [email protected]
RewriteEngine On
RewriteCond %{HTTP_HOST} ^users\.
RewriteRule /?(.*) http://users.example.org:8080/$1 [P,L]
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule /?(.*) http://www.example.org:8080/$1 [P,L]
RewriteRule /?(.*) http://www.example.org/$1 [R=permanent,L]
ErrorLog logs/example-error_log
CustomLog logs/example-access_log combined
</VirtualHost>
If you drop this file into the /etc/httpd/conf.d/ directory as deflate.conf then the front end Apache 2.x will do compression:
# Editor: vim:syn=apache
#
# mod deflate
<Location />
# More info: http://httpd.apache.org/docs-2.0/mod/mod_deflate.html
#
# Insert filter
SetOutputFilter DEFLATE
#
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
#
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
#
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
# BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
#
# Don't compress images or PDFs
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|pdf)$ no-gzip dont-vary
#
# Don't compress compressed data
SetEnvIfNoCase Request_URI \
\.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
#
# Don't compress compressed music, mp3's and ogg
SetEnvIfNoCase Request_URI \
\.(?:mp3|ogg)$ no-gzip dont-vary
#
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</Location>