Following are instructions for installing apache and mod_perl by compiling them from source for a back-end MKDoc server and using Apache 2.x as a front facing proxy.
Compiling Apache 1.3.x from source is generally needed for MKDoc (Apache 2.x which comes with many GNU/Linux distros is not suitable), see the mod_perl site for more details.
See the alternative instructions for running Apache 1.3.x without a Apache 2.x proxy.
Apache, mod_perl
Download the source code
The latest apache 1.3.x can be downloaded from here: http://httpd.apache.org/download.cgi
The latest mod_perl from here: http://perl.apache.org/download/
wget http://www.mirrorservice.org/sites/ftp.apache.org/httpd/apache_1.3.37.tar.gz
wget http://www.apache.org/dist/httpd/apache_1.3.37.tar.gz.asc
wget http://perl.apache.org/dist/mod_perl-1.30.tar.gz
wget http://perl.apache.org/dist/mod_perl-1.30.tar.gz.asc
Check the sigs
gpg --keyserver=wwwkeys.eu.pgp.net --recv-key 10FDE075
gpg --verify apache_1.3.37.tar.gz.asc
gpg --keyserver=wwwkeys.eu.pgp.net --recv-key 88C3A5A5
gpg --verify mod_perl-1.30.tar.gz.asc
Uncompress and extract
tar -zxvf apache_1.3.37.tar.gz
tar -zxvf mod_perl-1.30.tar.gz
Make and install
Make and install mod_perl with mod_gzip and apache:
cd mod_perl-1.30
perl Makefile.PL APACHE_SRC=../apache_1.3.37/src \
DO_HTTPD=1 EVERYTHING=1 USE_APACI=1
make
make test
sudo make install
cd ../apache_1.3.37
sudo make install
Configure Apache
This should simply be a matter of adding this line to the end of the /usr/local/apache/conf/httpd.conf file:
NameVirtualHost *
And then after this the MKDoc include line, see the MKDoc INSTALL document for this.
Start Apache
Apache can now be started, it will run on port 8080 by default if you complied it as a user other than root (this is fine if you are using Apache 2.x as a front facing proxy):
sudo /usr/local/apache/bin/apachectl start
And if you want it to start after a reboot you can add this to /etc/rc.local (sourcing the mksetenv.sh script is essential for MKDoc to work properly and you chould change the path to where ever you have MKDoc installed):
source /var/mkdoc/mksetenv.sh
sudo /usr/local/apache/bin/apachectl start
Or you could use the following script that has been tested on Fedora Core 5 (it assumes Apache is installed in /usr/local/apache and that MKDoc is in /usr/local/mkdoc-1-6 — edit it to suit):
cd /usr/local/apache/bin
sudo ln -s httpd apache
cd /etc/init.d/
sudo wget http://www.mkdoc.org.archived.website/docs/howto/apache/apache.txt
sudo mv apache.txt /etc/init.d/apache
sudo chmod 755 /etc/init.d/apache
sudo /sbin/chkconfig --add apache
sudo /etc/init.d/apache start
sudo /sbin/chkconfig apache on
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.x 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 / Red Hat 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 admin@example.org
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.org-error_log
CustomLog logs/example.org-access_log combined
</VirtualHost>
You will also need to make MKDoc rempove the port numbers from links in pages, you do this by editing this in the httpd-env.conf file for each site:
# Uncomment if you want the following port numbers (comma separated) to be stripped from URLs.
SetEnv MKD__URL_PORT_STRIP_REGEX "8080"
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>
- the mod_perl site
-
mod_perl install documantation
http://perl.apache.org/docs/1.0/guide/install.html
- alternative instructions
-
Instructions for building Apache 1.3.x with mod_gzip
http://mkdoc.org.archived.website/docs/howto/apache/.print.html./alt