APACHE CONFIGURATION Apache 1.3 Autoconf-style Interface (APACI) =========================================== APACI is an Autoconf-style interface for the Unix side of the Apache 1.3 HTTP server source distribution. It is actually not GNU Autoconf-based, i.e. the GNU Autoconf package itself is not used. Instead APACI just provides a similar batch configuration interface and a corresponding out-of-the-box build and installation procedure. The basic goal is to provide the following commonly known and expected procedure for out-of-the-box building and installing a package like Apache: $ gunzip <apache_1.3.X.tar.gz | tar xvf - $ ./configure --prefix=PREFIX [...] $ make $ make install NOTE: PREFIX is not the string "PREFIX". Instead use the Unix filesystem path under which Apache should be installed. For instance use "/usr/local/apache" for PREFIX above. After these steps Apache 1.3 is completely installed under PREFIX and already initially configured, so you can immediately fire it up the first time via $ PREFIX/sbin/apachectl start to get your first success event with the Apache HTTP server without having to fiddle around with various options for a long time. On the other hand APACI provides a lot of options to adjust the build and installation process for flexibly customizing your Apache installation. So, APACI provides both: Out-of-the-box building and installation for the impatient and powerful custom configuration for the experts. Detailed Description ==================== For a detailed description of all available APACI options please read the file INSTALL or at least run the command $ ./configure --help for a compact one-page summary of the possibilities you have. Alternatively, you can start from the following examples. Examples ======== In the following typical or even interesting variants of the available configuration steps are shown to give you an impression what APACI is good for and what APACI can do for you to be able to install Apache without much pain. Standard installation --------------------- The standard installation is done via $ ./configure --prefix=/path/to/apache $ make $ make install This builds Apache 1.3 with the standard set of enabled modules (automatically determined from src/Configuration.tmpl) with an Apache 1.2 conforming subdirectory layout under /path/to/apache. For using the GNU style subdirectory layout additionally use the --with-layout=GNU option: $ ./configure --with-layout=GNU --prefix=/path/to/apache $ make $ make install If you are not sure which directory layout you want, you can use the --show-layout option. It displays the directory layout which would be used but immediately exits without configuring anything. Examples: $ ./configure --show-layout $ ./configure --prefix=/path/to/apache --show-layout $ ./configure --with-layout=GNU --prefix=/path/to/apache --show-layout Additionally if some of the shown paths still don't fit for your particular situation, you can use the --bindir, --sbindir, --libexecdir, --mandir, --sysconfdir, --datadir, --localstatedir, --runtimedir, --logfiledir and --proxycachedir options to adjust the layout as required. Always check with --show-layout the resulting directory layout which would be used for installation. suEXEC support -------------- The suEXEC feature of Apache provides a mechanism to run CGI and SSI programs under the user and group id of the owner of the program. It is neither installed nor configured per default for Apache 1.3, but APACI supports it with additional options: $ ./configure --prefix=/path/to/apache \ --enable-suexec \ --suexec-caller=www \ --suexec-userdir=.www \ --suexec-docroot=/path/to/root/dir \ --suexec-logfile=/path/to/logdir/suexec_log \ --suexec-uidmin=1000 \ --suexec-gidmin=1000 \ --suexec-safepath="/bin:/usr/bin" $ make $ make install This automatically builds and installs Apache 1.3 with suEXEC support for the caller uid "www" and the user's homedir subdirs ".www". The default paths for --suexec-docroot is the value from the --datadir option with the suffix "/htdocs" and the --logfiledir value with the suffix "/suexec_log" for the --suexec-logfile option. The access paths for the suexec program are automatically adjusted and the suexec program is installed, so Apache can find it on startup. Building multiple platforms in parallel --------------------------------------- When you want to compile Apache for multiple platforms in parallel it is useful to share the source tree (usually via NFS, AFS or DFS) but build the object files in separated subtrees. This can be accomplished by letting APACI create a source shadow tree and build there: $ ./configure --shadow --prefix=/path/to/apache $ make $ make install Then APACI first determines the GNU platform triple, creates a shadow tree in src.<gnu-triple> plus corresponding Makefile.<gnu-triple> and then performs the complete build process inside this shadow tree. Dynamic Shared Object (DSO) support ----------------------------------- Apache 1.3 supports building modules as shared objects on all major Unix platforms (see section "Supported Platforms" in document htdocs/manual/dso.html for details). APACI has a nice way of enabling the building of DSO-based modules and automatically installing them: $ ./configure --prefix=/path/to/apache \ --enable-module=rewrite \ --enable-shared=rewrite $ make $ make install This builds and installs Apache with the default configuration except that it adds the mod_rewrite module and automatically builds and installs it as a DSO, so it is optionally available for loading under runtime. To make your life even more easy APACI additionally inserts a corresponding `LoadModule' line into the httpd.conf file in the installation phase. APACI also supports a variant of the --enable-shared option: $ ./configure --prefix=/path/to/apache \ --enable-shared=max $ make $ make install This enables shared object building for the maximum of modules, i.e. all enabled modules (--enable-module or the default set) except for mod_so itself (the bootstrapping module for DSO support). So, to build a full-powered Apache with maximum flexibility by building and installing most of the modules, you can use: $ ./configure --prefix=/path/to/apache \ --enable-module=most \ --enable-shared=max $ make $ make install This first enables most of the modules (all modules except some problematic ones like mod_auth_db which needs third party libraries not available on every platform or mod_log_agent and mod_log_referer which are deprecated) and then enables DSO support for all of them. This way you get all these modules installed and you then can decide under runtime (via the `LoadModule') directives which ones are actually used. This is especially useful for vendor package maintainers to provide a flexible Apache package. On-the-fly added additional/private module ------------------------------------------ For Apache there are a lot of modules flying around on the net which solve particular problems. For a good reference see the Apache Module Registory at http://modules.apache.org/ and the Apache Group's contribution directory at http://www.apache.org/dist/contrib/modules/. These modules usually come in a file named mod_foo.c. APACI supports adding these sources on-the-fly to the build process: $ ./configure --prefix=/path/to/apache \ --add-module=/path/to/mod_foo.c $ make $ make install This automatically copies mod_foo.c to src/modules/extra/, activates it in the configuration and builds Apache with it. A very useful way is to combine this with the DSO support: $ ./configure --prefix=/path/to/apache \ --add-module=/path/to/mod_foo.c \ --enable-shared=foo $ make $ make install This builds and installs Apache with the default set of modules, but additionally builds mod_foo as a DSO and adds a `LoadModule' line to the httpd.conf file to activate it for loading under runtime. Apache and mod_perl ------------------- The Apache/Perl integration project (http://perl.apache.org/) from Doug MacEachern <dougm@perl.apache.org> is a very powerful approach to integrate a Perl 5 interpreter into the Apache HTTP server both for running Perl programs and for programming Apache modules in Perl. The distribution mod_perl-1.XX.tar.gz can be found on http://perl.apache.org/src/. Here is how you can build and install Apache with mod_perl: $ gunzip <apache_1.3.X.tar.gz | tar xvf - $ gunzip <mod_perl-1.XX.tar.gz | tar xvf - $ cd mod_perl-1.XX $ perl Makefile.PL APACHE_SRC=../apache_1.3.X/src \ DO_HTTPD=1 USE_APACI=1 \ [EVERYTHING=1 ...] $ make $ make install [optionally you now have the chance to prepare or add more third-party modules to the Apache source tree] $ cd ../apache_1.3.X $ ./configure --prefix=/path/to/apache \ --activate-module=src/modules/perl/libperl.a \ [--enable-shared=perl] $ make $ make install Apache and PHP -------------- The PHP language (http://www.php.net) is an HTML-embedded scripting language which can be directly integrated into the Apache HTTP server for powerful HTML scripting. The package can be found at http://www.php.net/downloads.php 1. How you can install Apache with a statically linked PHP: $ gunzip <apache_1.3.X.tar.gz | tar xvf - $ gunzip <php-3.0.tar.gz | tar xvf - $ cd apache_1.3.X $ ./configure --prefix=/path/to/apache $ cd ../php-3.0 $ ./configure --with-apache=../apache_1.3.X $ make $ make install [optionally you now have the chance to prepare or add more third-party modules to the Apache source tree] $ cd ../apache_1.3.X $ ./configure --prefix=/path/to/apache \ --activate-module=src/modules/php3/libphp3.a $ make $ make install 2. You can also use APXS: $ cd apache-1.3.X $ ./configure --prefix=/path/to/apache --enable-shared=max $ make $ make install $ cd php-3.0.X $ ./configure --with-apxs=/path/to/apache/bin/apxs \ --with-config-file-path=/path/to/apache $ make $ make install At this point don't forget to edit your conf/httpd.conf file and make sure the file contains the line for PHP 3: AddType application/x-httpd-php3 .php3 Or this line for PHP 4: AddType application/x-httpd-php .php Then restart your server.