Apache-2.2.21

Introduction to Apache

The Apache package contains an open-source HTTP server. It is useful for creating local intranet web sites or running huge web serving operations.

This package is known to build and work properly using an LFS-7.0 platform.

Package Information

Additional Downloads

Apache Dependencies

Optional

OpenLDAP-2.4.23, OpenSSL-1.0.0e (also used in the bundled APR-util), PCRE-8.12, rsync-3.0.9, Lynx-2.8.7rel.2, APR, APR-util, and distcache

Optional (Only if Using the Bundled APR-util)

expat-2.0.1, Berkeley DB-5.2.36, unixODBC-2.3.0, MySQL-5.5.17, PostgreSQL-9.0.6, SQLite-3.7.8, Oracle 11g, and FreeTDS

Though you can install APR and APR-util as separate components, the bundled versions that come with the Apache HTTPD tarball are recommended.

User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/apache

Installation of Apache

For security reasons, running the server as an unprivileged user and group is strongly encouraged. Create the following group and user using the following commands (as root):

groupadd -g 25 apache &&
useradd -c "Apache Server" -d /dev/null -g apache \
        -s /bin/false -u 25 apache
[Note]

Note

The above command directs the Apache user's home directory to /dev/null. This may not work for some add-ons such as ViewVC, a browser interface for CVS and Subversion version control repositories. See the User Notes for details for specific applications.

The following patch modifies 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.2.21-config-1.patch
[Note]

Note

You may wish to review the output from ./configure --help and include whatever parameters are necessary to the configure command below to build the modules required for your installation. There are as many as 65 additional parameters you can add to the configure command to build additional modules. Some of the extra parameters which aren't described or mentioned in the --help information are listed in the “Command Explanations” section below.

If you are using the bundled version of APR-util and you are going to install Subversion with Berkeley DB back-end support, ensure you use the parameters shown in the “Command Explanations” section below.

While it is not built by default when using the following commands, the ISAPI DSO module can be created by adding the --enable-isapi option. Even though the module will compile, install and load fine, the module is only supported and functional in Win32 environments.

Build and install Apache by running the following commands:

./configure --enable-layout=FHS      \
                               --enable-mods-shared=all \
                               --enable-so &&
make

This package does not come with a test suite.

Now, as the root user:

make install &&
chown -v root:root /usr/lib/apache/httpd.exp                     \
    /usr/sbin/{apxs,apachectl,dbmmanage,envvars{,-std}}          \
    /usr/share/man/man1/{dbmmanage,ht{dbm,digest,passwd}}.1      \
    /usr/share/man/man8/{ab,apachectl,apxs,htcacheclean,httpd}.8 \
    /usr/share/man/man8/{logresolve,rotatelogs,suexec}.8 &&
chown -v -R apache:apache /srv/www

Command Explanations

--enable-mods-shared=all: The modules should 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.

--enable-ssl: Use this parameter to create the mod_ssl module and enable SSL support. This parameter is mentioned as one of many parameters which can be passed to the configure command to create additional DSO modules.

--with-pcre: Add this parameter to use the system installed version of the PCRE library.

--with-z: Add this parameter to use the system installed version of the Zlib library.

--with-ldap: This parameter is required if you passed the --enable-authnz-ldap or --enable-ldap options to configure and enabled the OpenLDAP modules.

--with-dbm=db4 --with-berkeley-db: Use these parameters if you require Berkeley DB support in the bundled version of APR-util (required for Berkeley DB back-end support in Subversion). If you are using Berkeley DB-5.1, change the first parameter to --with-dbm=db51.

--with-mysql: Add this parameter to use the system installed version of MySQL.

--with-included-apr: Add this parameter to use the bundled version of the APR system. The default is to use a system-installed version, if one if available. Use this parameter to force the build to use and then install (overwriting the existing APR) the internal (bundled) copy of the APR.

chown root:root ...: This command changes the ownership of some installed files, the result of building the package as a user other than root.

chown -R apache:apache /srv/www: By default, the installation process installs files (documentation, error messages, default icons, etc.) with the ownership of the user that extracted the files from the tar file. If you want to change the ownership to another user, you should do so at this point. The only requirement is that the document directories need to be accessible by the httpd process with (r-x) permissions and files need to be readable (r--) by the apache user.

Configuring Apache

Config Files

/etc/apache/*

Configuration Information

The main configuration file is named /etc/apache/httpd.conf. Modify it so that the HTTP server runs as the dedicated user and group:

sed -i -e "s/User daemon/User apache/" \
       -e "s/Group daemon/Group apache/" \
    /etc/apache/httpd.conf

See http://httpd.apache.org/docs-2.2/configuring.html for detailed instructions on customizing your Apache HTTP server configuration file.

Boot Script

If you want the Apache server to start automatically when the system is booted, install the /etc/rc.d/init.d/httpd init script included in the blfs-bootscripts-20111226 package.

make install-httpd

Contents

Installed Programs: ab, apachectl, apr-1-config, apu-1-config, apxs, checkgid, dbmmanage, htcacheclean, htdbm, htdigest, htpasswd, httpd, httxt2dbm, logresolve, rotatelogs, and suexec
Installed Libraries: libapr-1.{so,a}, libaprutil-1.{so,a}, apr_{dbd,ldap} database modules, and numerous DSO modules
Installed Directories: /etc/apache, /srv/www, /usr/include/apache, /usr/lib/apache, /usr/lib/apr-util-1, and /var/log/apache

Short Descriptions

ab

is a tool for benchmarking your Apache HTTP server.

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.

apr-1-config

is a simple script that provides information about the installed APR program.

apu-1-config

is a simple script that provides information about the installed APR-Util program.

apxs

is a tool for building and installing extension modules for the Apache HTTP server.

checkgid

is a program that checks whether it can setgid to the group specified. This is to see if it is a valid group for Apache2 to use at runtime. If the user (should be run as superuser) is in that group, or can setgid to it, it will return 0.

dbmmanage

is used to create and update the DBM format files used to store usernames and passwords for basic authentication of HTTP users.

htcacheclean

is used to clean up the disk cache.

htdbm

is used to manipulate the DBM password databases.

htdigest

is used to create and update the flat-files used to store usernames, realms and passwords for digest authentication of HTTP users.

htpasswd

is used to create and update the flat-files used to store usernames and passwords for basic authentication of HTTP users.

httpd

is the Apache HTTP server program.

httxt2dbm

is used to generate DBM files from text input, for use in RewriteMap.

logresolve

is a post-processing program to resolve IP-addresses in Apache's access log files.

rotatelogs

is a simple program for use in conjunction with Apache's piped log file feature.

suexec

is used by the Apache HTTP Server to switch to another user before executing CGI programs.

Last updated on 2011-12-12 20:16:56 +0000