mount -wo remount /
cd /usr/src
tar -xjf httpd-2.0.49.tar.bz2
cd httpd-2.0.49
groupadd apache &&
useradd -c apache -d /dev/null -g apache -s /bin/false apache
patch -Np1 -i ../httpd-2.0.49-config.patch
./configure --with-expat=/usr --enable-ssl --enable-layout=LFS \
--enable-mods-shared=all &&
make &&
make install
sed -i -e "s%User nobody%User apache%" -e "s%^Group #-1%Group apache%" /etc/apache/httpd.conf
cat > /etc/rc.d/init.d/apache << "EOF"
#!/bin/sh
. /etc/sysconfig/rc
. $rc_functions
case "$1" in
start)
logecho "Starting Apache daemon..."
/usr/sbin/apachectl -k start
evaluate_retval
;;
stop)
logecho "Stopping Apache daemon..."
/usr/sbin/apachectl -k stop
evaluate_retval
;;
restart)
logecho "Restarting Apache daemon..."
/usr/sbin/apachectl -k restart
evaluate_retval
;;
status)
statusproc /usr/sbin/httpd
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
EOF
chmod 754 /etc/rc.d/init.d/apache
mount -ro remount /
The mount commands are necessary because our systems run with a read-only root filesystem (which is
where we will be installing Apache). The build takes place in /usr/src/httpd-2.0.49 (the Apache source tree
after it is uncompressed by tar), and the install is to directories in the /usr directory tree.
This configuration is based on Beyond Linux From Scratch 5.1, and causes Apache to run its slave processes under the unprivileged user "apache". The "expat" parameter to configure tells Apache to use the version of expat (a C library for parsing XML) which is already installed. The file /etc/rc.d/init.d/apache is the script used to start and stop Apache.
The access_log file contains the following information for every file served to a client:
©2005, Kenneth R. Koehler. All Rights Reserved. This document may be freely reproduced provided that this copyright notice is included.
Please send comments or suggestions to the author.