The Apache package contains an open-source HTTP server. It is useful for creating local intranet web sites or running huge web serving operations.
Download (HTTP): http://www.apache.org/dist/httpd/httpd-2.0.47.tar.gz
Download (FTP): ftp://ftp.tux.org/pub/net/apache/dist/httpd/httpd-2.0.47.tar.gz
Download size: 5.9 MB
Estimated Disk space required: 95 MB
Estimated build time: 1.31 SBU
Berkeley DB-4.1.25 or GDBM-1.8.3, OpenSSL-0.9.7c, OpenLDAP-2.1.22 and Lynx-2.8.4
For security reasons, running the server as an unprivileged user and group is strongly encouraged.
groupadd apache && useradd -c apache -d /dev/null -g apache -s /bin/false apache |
The following patch will define the layout of destination directories and, among them, the build directory at /usr/lib/apache/build. This will allow the modules added to Apache to be configured without errors. Apply the patch:
patch -Np1 -i ../httpd-2.0.47-config.patch |
Build and install Apache by running the following commands:
./configure --enable-layout=LFS \ --enable-mods-shared=all && make && make install |
--enable-mods-shared=all: We want modules to be compiled and used as Dynamic Shared Objects (DSOs) so they can be included and excluded from the server using the run-time configuration directives.
The main configuration file is called httpd.conf. See http://httpd.apache.org/docs-2.0/configuring.html for detailed instructions on customizing your Apache HTTP server.
To automate the running of Apache, use the following command to create the init.d script:
cat > /etc/rc.d/init.d/apache << "EOF" #!/bin/bash source /etc/sysconfig/rc source $rc_functions case "$1" in start) echo "Starting Apache daemon..." /usr/sbin/apachectl -k start evaluate_retval ;; stop) echo "Stopping Apache daemon..." /usr/sbin/apachectl -k stop evaluate_retval ;; restart) echo "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 755 /etc/rc.d/init.d/apache |
Create the symbolic links to this file in the relevant rc.d directory with the following commands:
cd /etc/rc.d/init.d && ln -sf ../init.d/apache ../rc0.d/K28apache && ln -sf ../init.d/apache ../rc1.d/K28apache && ln -sf ../init.d/apache ../rc2.d/K28apache && ln -sf ../init.d/apache ../rc3.d/S32apache && ln -sf ../init.d/apache ../rc4.d/S32apache && ln -sf ../init.d/apache ../rc5.d/S32apache && ln -sf ../init.d/apache ../rc6.d/K28apache |
The Apache package provides ab, apachectl, apr-config, apu-config, apxs, checkgid, dbmmanage, htdbm, htdigest, htpasswd, httpd, instdso.sh, logresolve, rotatelogs, libapr, libaprutil and various modules.
apachectl is a front end to the Apache HTTP server which is designed to help the administrator control the functioning of the Apache httpd daemon.
dbmmanage is used to create and update the DBM format files used to store usernames and password for basic authentication of HTTP users.
htdigest is used to create and update the flat-files used to store usernames, realm and password for digest authentication of HTTP users.
htpasswd is used to create and update the flat-files used to store usernames and password for basic authentication of HTTP users.