#!/bin/sh # Apache and friends build script # 11/24/2002 ##### # Apache / suexec # Mod Gzip # Mod Perl # Mod PHP (built in) w/ pgsql, imap, ftp support # xor # PHP-suexec (standalone) w/ pgsql, imap, ftp support # Mod SSL # Mod Throttle ##### ### Step 1: Configuration SUEXEC=1 MODGZIP=1 MODPERL=0 # You can have mod_php or php-suexec, but NOT BOTH! MODPHP=1 PHPSUEXEC=0 MODSSL=0 MODTHROTTLE=1 SUEXEC_USER=httpd SUEXEC_GROUP=nofiles SUEXEC_UIDMIN=999 SUEXEC_GIDMIN=100 APACHE_VERSION="1.3.27" PHP_VERSION="4.2.3" MODSSL_VERSION="2.8.11" MODPERL_VERSION="1.27" MODTHROTTLE_VERSION_SHORT="312" MODTHROTTLE_VERSION_LONG="3.1.2" ### PostgreSQL must be compiled beforehand if you want this to work. PGSQL_DIR="/usr/local/pgsql" ### Step 2: source code retrieval. #wget http://httpd.apache.org/dist/httpd/apache_$APACHE_VERSION.tar.gz tar zxf apache_$APACHE_VERSION.tar.gz if [ $MODSSL == 1 ]; then #wget http://www.modssl.org/source/mod_ssl-$MODSSL_VERSION-$APACHE_VERSION.tar.gz tar zxf mod_ssl-$MODSSL_VERSION-$APACHE_VERSION.tar.gz fi ### If you are doing either PHP or PHP-suexec, grab this if [ $MODPHP == 1 || $PHPSUEXEC == 1 ]; then #wget http://www.php.net/distributions/php-$PHP_VERSION.tar.gz tar zxf php-$PHP_VERSION.tar.gz #wget ftp://ftp.cac.washington.edu/imap/imap.tar.Z tar zxf imap.tar.Z fi if [ $MODPERL == 1 ]; then # wget http://perl.apache.org/dist/mod_perl-$MODPERL_VERSION.tar.gz tar zxf mod_perl-$MODPERL_VERSION.tar.gz fi if [ $MODTHROTTLE == 1 ]; then #wget http://www.snert.com/Software/mod_throttle/mod_throttle$MODTHROTTLE_VERSION_SHORT.tgz tar zxf mod_throttle$MODTHROTTLE_VERSION_SHORT.tgz fi if [ $MODGZIP == 1 ]; then #wget http://www.remotecommunications.com/apache/mod_gzip/src/1.3.19.1a/mod_gzip.c.gz gunzip mod_gzip.c.gz fi ### ### Step 3: Compilation. ### # ----- mod_ssl if [ $MODSSL == 1 ]; then cd mod_ssl-$MODSSL_VERSION-$APACHE_VERSION/ ./configure --with-apache=../apache_$APACHE_VERSION cd .. fi # ----- Apache 1.3 cd apache_$APACHE_VERSION/ if [ $SUEXEC == 1 ]; then CONF_SUEXEC=" --enable-suexec \ --suexec-caller=$SUEXEC_USER \ --suexec-docroot=/vsn \ --suexec-logfile=/usr/local/apache/logs/suexec_log \ --suexec-uidmin=$SUEXEC_UIDMIN \ --suexec-gidmin=$SUEXEC_GIDMIN" fi if [ $MODSSL == 1 ]; then CONF_MODSSL=" --enable-module=ssl" fi ### Actually config and compile now ./configure \ --prefix=/usr/local/apache \ --enable-module=so \ $CONF_SUEXEC \ $CONF_MODSSL make make install # (installs to /usr/local/apache) cd .. # ----- end of core apache installation if [ $MODPHP == 1 ]; then # ----- IMAP Support cd imap-*/ # Something in the Makefile has to be edited to turn off SSL!! # IMAP's internal SSL doesn't seem to compile to save its life. make slx #copy the imap c-client directory to /usr/local/lib/c-client cp -R c-client /usr/local/lib/ cd ../ # ----- PHP cd php-$PHP_VERSION ./configure --with-apxs=/usr/local/apache/bin/apxs \ --enable-force-cgi-redirect \ --enable-discard-path \ --enable-ftp \ --enable-memory-limit \ --enable-ucd-snmp-hack \ --with-imap=/usr/local/lib \ --with-pgsql=$PGSQL_DIR make make install cd .. fi # End if mod_php if [ $PHPSUEXEC == 1 ]; then cd php-$PHP_VERSION ./configure --enable-force-cgi-redirect \ --enable-discard-path \ --enable-ftp \ --enable-memory-limit \ --enable-ucd-snmp-hack \ --with-imap=/usr/local/lib \ --with-pgsql=$PGSQL_DIR make make install cd .. fi if [ $MODPHP == 1 || $PHPSUEXEC == 1 ]; then if [ $SUEXEC == 1 ]; then # This is actually for our webmail. Should no longer be needed since webmail # is no longer on the main web server. it has its own custom install. # Of course, webmail code will have to be modified to not put cookies there. mkdir -p /usr/local/lib/php/sessions chown $SUEXEC_USER /usr/local/lib/php/sessions chgrp $SUEXEC_GROUP /usr/local/lib/php/sessions chmod 700 /usr/local/lib/php/sessions echo "You may need a php.ini file to make PHP write session files to /usr/local/lib/php/sessions. this might have been fixed since 4.0.4 tho." fi fi # ----- mod_perl, compiled with much blood, sweat and tears if [ $MODPERL == 1 ]; then cd mod_perl-$MODPERL_VERSION perl Makefile.PL \ USE_APXS=1 \ WITH_APXS=/usr/local/apache/bin/apxs \ PERL_USELARGEFILES=0 \ EVERYTHING=1 make && \ make install cd .. fi if [ $MODTHROTTLE == 1 ]; then # ----- mod_throttle. cd mod_throttle-$MODTHROTTLE_VERSION_LONG/ sed Makefile -e "s/APXS=apxs/APXS=\/usr\/local\/apache\/bin\/apxs/" > Makefile2 mv Makefile2 Makefile make make install cd .. fi # ----- mod_gzip. if [ $MODGZIP == 1 ]; then /usr/local/apache/bin/apxs -i -a -c mod_gzip.c fi echo "All set. Do your own configuration files. I'm not God!"