Skip Navigation

Sign Up

If you sign up for an account on this web site you can customise elements of this site and subscribe to an email newsletter.

If you have an account on this web site you may login.

If you have an account on this site but have forgotten your user name and / or your password then you can request an account reminder email.

HowTo Compile Apache 1.3 for MKDoc

Following are instructions for installing apache and mod_perl with mod_gzip by compiling them from source, this 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 instructions at the bottom of this document for using a combination of apache-1.3 and apache-2.x to get the best of both worlds.

Apache, mod_perl and mod_gzip

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/

And mod_gzip from here: http://sourceforge.net/projects/mod-gzip/

wget ftp://mirror.positive-internet.com/apache/httpd/apache_1.3.33.tar.gz
wget ftp://mirror.positive-internet.com/apache/httpd/apache_1.3.33.tar.gz.asc
wget http://perl.apache.org/dist/mod_perl-1.29.tar.gz
wget http://perl.apache.org/dist/mod_perl-1.29.tar.gz.asc
wget http://heanet.dl.sourceforge.net/sourceforge/mod-gzip/mod_gzip-1.3.26.1a.tgz

Check the sigs

gpg --recv-key 08C975E5
gpg --verify apache_1.3.33.tar.gz.asc
gpg --recv-key 88C3A5A5
gpg --verify mod_perl-1.29.tar.gz.asc

Uncompress and extract

tar -zxvf apache_1.3.33.tar.gz
tar -zxvf mod_perl-1.29.tar.gz
tar -zxvf mod_gzip-1.3.26.1a.tgz

Copy mod_gzip source into the apache source tree and edit the Makefile.tmpl:

mkdir apache_1.3.33/src/modules/gzip
cp mod_gzip-1.3.26.1a/*.c apache_1.3.33/src/modules/gzip/
cp mod_gzip-1.3.26.1a/*.h apache_1.3.33/src/modules/gzip/
cp mod_gzip-1.3.26.1a/Makefile.tmpl apache_1.3.33/src/modules/gzip/
vi apache_1.3.33/src/modules/gzip/Makefile.tmpl
:1,$s/LIB=libgzip.\$(LIBEXT)/LIB=libgzip.a/

Make and install

Make and install mod_perl with mod_gzip and apache:

cd mod_perl-1.29
perl Makefile.PL APACHE_SRC=../apache_1.3.33/src \
  DO_HTTPD=1 EVERYTHING=1 USE_APACI=1 \
  APACI_ARGS='--activate-module=src/modules/gzip/mod_gzip.c'
make
make test
su
make install
cd ../apache_1.3.33
make install

Configure mod_gzip

Add this to /usr/local/apache/conf/httpd.conf:

# mod_gzip
<IfModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_item_include handler ^perl-script$
  mod_gzip_item_include mime text/html
  mod_gzip_item_include mime text/plain
  mod_gzip_item_include mime text/css
  mod_gzip_item_include mime application/xml
  mod_gzip_dechunk yes
  mod_gzip_min_http 1000
  mod_gzip_temp_dir /tmp
  mod_gzip_keep_workfiles No
  mod_gzip_minimum_file_size  1000
  mod_gzip_maximum_file_size  0
  mod_gzip_maximum_inmem_size 1000000
  mod_gzip_can_negotiate Yes
</IfModule>

Start Apache

Apache can now be started:

/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 whereever you have MKDoc installed):

source /var/mkdoc/mksetenv.sh
/usr/local/apache/bin/apachectl start

Apache, mod_ssl, mod_perl and mod_gzip

The following assumes that you have openssl-devel packages installed already and in their default locations, if not see the mod_perl and mod_ssl instructions on perl.apache.org for using a source disto of openssl.

Download the source code

The latest apache 1.3.x can be downloaded from here: http://httpd.apache.org/download.cgi

The latest mod_ssl from here: http://www.modssl.org/source/

The latest mod_perl from here: http://perl.apache.org/download/

And mod_gzip from here: http://sourceforge.net/projects/mod-gzip/

wget ftp://mirror.positive-internet.com/apache/httpd/apache_1.3.33.tar.gz
wget ftp://mirror.positive-internet.com/apache/httpd/apache_1.3.33.tar.gz.asc
wget http://www.modssl.org/source/mod_ssl-2.8.24-1.3.33.tar.gz
wget http://www.modssl.org/source/mod_ssl-2.8.24-1.3.33.tar.gz.asc
wget http://perl.apache.org/dist/mod_perl-1.29.tar.gz
wget http://perl.apache.org/dist/mod_perl-1.29.tar.gz.asc
wget http://heanet.dl.sourceforge.net/sourceforge/mod-gzip/mod_gzip-1.3.26.1a.tgz

Check the sigs

gpg --recv-key 08C975E5
gpg --verify apache_1.3.33.tar.gz.asc
gpg --recv-key 26BB437D
gpg --verify mod_ssl-2.8.24-1.3.33.tar.gz.asc
gpg --recv-key 88C3A5A5
gpg --verify mod_perl-1.29.tar.gz.asc

Uncompress and extract

tar -zxvf apache_1.3.33.tar.gz
tar -zxvf mod_ssl-2.8.24-1.3.33.tar.gz
tar -zxvf mod_perl-1.29.tar.gz
tar -zxvf mod_gzip-1.3.26.1a.tgz

Copy mod_gzip source into the apache source tree and edit the Makefile.tmpl:

mkdir apache_1.3.33/src/modules/gzip
cp mod_gzip-1.3.26.1a/*.c apache_1.3.33/src/modules/gzip/
cp mod_gzip-1.3.26.1a/*.h apache_1.3.33/src/modules/gzip/
cp mod_gzip-1.3.26.1a/Makefile.tmpl apache_1.3.33/src/modules/gzip/
vi apache_1.3.33/src/modules/gzip/Makefile.tmpl
:1,$s/LIB=libgzip.\$(LIBEXT)/LIB=libgzip.a/

Make and install

Make and install mod_perl with mod_gzip and apache:

cd mod_ssl-2.8.23-1.3.33
./configure --with-apache=../apache_1.3.33
cd ../mod_perl-1.29
perl Makefile.PL APACHE_SRC=../apache_1.3.33/src \
  DO_HTTPD=1 EVERYTHING=1 USE_APACI=1 \
  APACI_ARGS='--enable-module=ssl,--activate-module=src/modules/gzip/mod_gzip.c'
make
make test
su
make install
cd ../apache_1.3.33
make install

Apache, mod_ssl and mod_perl

The following assumes that you have openssl-devel packages installed already and in their default locations, if not see the mod_perl and mod_ssl instructions on perl.apache.org for using a source disto of openssl.

Download the source code

The latest apache 1.3.x can be downloaded from here: http://httpd.apache.org/download.cgi

The latest mod_ssl from here: http://www.modssl.org/source/

The latest mod_perl from here: http://perl.apache.org/download/

wget ftp://mirror.positive-internet.com/apache/httpd/apache_1.3.33.tar.gz
wget ftp://mirror.positive-internet.com/apache/httpd/apache_1.3.33.tar.gz.asc
wget http://www.modssl.org/source/mod_ssl-2.8.24-1.3.33.tar.gz
wget http://www.modssl.org/source/mod_ssl-2.8.24-1.3.33.tar.gz.asc
wget http://perl.apache.org/dist/mod_perl-1.29.tar.gz
wget http://perl.apache.org/dist/mod_perl-1.29.tar.gz.asc

Check the sigs

gpg --recv-key 08C975E5
gpg --verify apache_1.3.33.tar.gz.asc
gpg --recv-key 26BB437D
gpg --verify mod_ssl-2.8.24-1.3.33.tar.gz.asc
gpg --recv-key 88C3A5A5
gpg --verify mod_perl-1.29.tar.gz.asc

Uncompress and extract

tar -zxvf apache_1.3.33.tar.gz
tar -zxvf mod_ssl-2.8.24-1.3.33.tar.gz
tar -zxvf mod_perl-1.29.tar.gz

Make and install

Make and install mod_perl with mod_gzip and apache:

cd mod_ssl-2.8.24-1.3.33
./configure --with-apache=../apache_1.3.33
cd ../mod_perl-1.29
perl Makefile.PL APACHE_SRC=../apache_1.3.33/src \
  DO_HTTPD=1 EVERYTHING=1 USE_APACI=1 \
  APACI_ARGS='--enable-module=ssl'
make
make test
su
make install
cd ../apache_1.3.33
make install

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           admin[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>

Up

This document was last modified by Chris Croome on 2005-09-08 08:26:11
MKDoc Ltd., 31 Psalter Lane, Sheffield, S11 8YL, UK.
Copyright © 2001-2005 MKDoc Ltd.