Home arrow Apache arrow Page 8 - Building Apache the Way You Want It

Determining Apache’s Locations Individually - Apache

Have you ever wanted to customize Apache? This article will help you get started on building a customized version of Apache to suit your own needs. It is taken from chapter three of the book Pro Apache third edition, written by Peter Wainwright (Apress, 2004; ISBN: 1590593006).

TABLE OF CONTENTS:
  1. Building Apache the Way You Want It
  2. Building Apache from Source
  3. General Options
  4. Enabling or Disabling Modules in Bulk
  5. Changing the Module Order (Apache 1.3)
  6. Building Apache from Source As an RPM (Apache 2)
  7. Advanced Configuration
  8. Determining Apache’s Locations Individually
  9. Choosing a MultiProcessing Module (Apache 2)
  10. Building Apache with suExec support
  11. Configuring Apache 2 for Cross-Platform Builds
  12. Configuring the Build Environment
  13. Building Modules with apxs
By: Apress Publishing
Rating: starstarstarstarstar / 14
August 18, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

Each of Apache’s locations can also be set individually, including a few rare ones that aren’t (at least, as yet) permitted in the layout. The list of available options, with their defaults in the Apache layout, is detailed in Table 3-5.

Table 3-5. Configuration Directives Relating to Locations

Option

Description

--with-program-name=NAME (2.0) Installs name-associated files using the base name of

--target=NAME (1.3)

NAME. This changes the name of the Apache executable

from httpd to NAME and also changes the default names

of the configuration, scoreboard, process ID, and lock

files—httpd.conf becomes NAME.conf, and apachectl

becomes NAMEctl, and so on. This can be useful, along

with --runtimedir for running a second instance of

Apache with a different configuration in parallel with an

existing one.

The default is httpd. In Apache 1.3 this option is called

--target, but in Apache 2 it has been renamed to

--with-program-name to make way for the new portability

options --target, --host, and --build.

--prefix=PREFIX

Installs architecture-independent files in PREFIX. This

determines the primary installation location for Apache

and the default value of the server root, for instance,

/usr/local/apache under Unix. Most other locations

default to subdirectories of this value.

--exec-prefix=EPREFIX

Installs architecture-dependent files (meaning

principally compiled executables) in EPREFIX. This

determines the root location of executable files, from

which the --bindir, --sbindir, and --libexec directories

are derived (if specified as relative values). It defaults to

the same value as PREFIX if unspecified.

--bindir=DIR

Installs user executables and scripts in DIR. Usually

located in the bin directory under EPREFIX.

--sbindir=DIR

Installs sys admin executables in DIR [EPRIFIX/sbin].

--libexecdir=DIR

Installs program executables in DIR. This defines the

location of Apache’s dynamic modules, if any are

installed. Usually located in the libexec (1.3) or modules

(2.0) subdirectory under EPREFIX.

--mandir=DIR

Installs Unix manual pages for each of Apache’s

executables in DIR. Usually located in the man directory

under PREFIX. Not to be confused with --manualdir.

--sysconfdir=DIR

Installs configuration files such as httpd.conf and

mime.types in DIR. Usually located in the conf directory

under PREFIX.

(Continued)

Table 3-5. Configuration Directives Relating to Locations (Continued)  

Option

Description

--datadir=DATADIR

Installs read-only data files in DATADIR. This determines

the root location of all nonlocal data files, from which the

--installbuilddir, --errordir, --iconsdir, --htdocsdir,

--manualdir, and --cgidir directories are derived, if

specified as relative values. It defaults to the same value

as PREFIX if unspecified.

--errordir=DIR

Installs custom error documents into DIR. These are

referred to by ErrorDocument directives in the main

configuration file and produce nicer, and multilingual,

error messages than Apache’s built-in ones. Usually

located in the error directory under DATADIR. New in

Apache 2.

--iconsdir=DIR

Installs icons for directory indexing into DIR. AddIcon

directives in the main configuration file refer to these.

Usually located in the icons directory under DATADIR.

New in Apache 1.3.10.

--infodir=DIR

Installs documentation in GNU "info" format into DIR.

Apache itself doesn’t come with any information

documentation, but third-party modules might. Not

created by default but, is usually located in the info

directory under DATADIR. New in Apache 2.

--htdocsdir=DIR

Installs the default Apache startup Web page into DIR.

The master configuration uses this directory as the initial

value for the DocumentRoot directive. New in Apache 1.3.10.

--manualdir=DIR

Installs Apache’s HTML documentation into DIR. Usually

located in the manual directory under DATADIR. Not to be

confused with --mandir. New in Apache 1.3.21.

--cgidir=DIR

Installs the standard Apache CGI scripts into DIR. Usually

located in the cgi-bin directory under DATADIR. The

master configuration file points to this directory via a

ScriptAlias directive. New in Apache 1.3.10.

--includedir=DIR

Installs Apache’s header files in DIR. These are required

by apxs to compile modules without the full Apache

source tree available. Usually located in the include

directory under PREFIX.

--libdir=DIR

Installs Apache’s nonmodule object libraries in DIR.

Usually located in the lib directory under PREFIX. New in

Apache 2.

--localstatedir=LOCALDIR

Installs modifiable data files in DIR. This defines where

files that convey information about a particular instance

of Apache are kept. It usually governs the locations of the

runtime, log file, and proxy directories below. Usually the

same as PREFIX.

--runtimedir=DIR

Installs run-time data in DIR. This determines the default

locations of the process ID, scoreboard, and lock files.

Usually located in the logs subdirectory under LOCALDIR.

Table 3-5. Configuration Directives Relating to Locations (Continued)

Option

Description

--logfiledir=DIR

Installs log file data in DIR. This determines the default locations of the error and access logs. Usually located in the logs subdirectory under LOCALDIR.

--proxycachedir=DIR

Installs proxy cache data in DIR. This determines the default location of the proxy cache. Usually located in the proxy subdirectory under LOCALDIR.

--sharedstatedir=DIR

Installs shared modifiable data files in DIR. Not created by default, but usually the same as PREFIX. New in Apache 2.

When considering this list, it’s worth remembering that the directory organization is actually an artifact of the layout definitions in config.layout and not an implicit default; there’s nothing that automatically decides that the bin and sbin directories are under EPREFIX. The same is true for DATADIR and LOCALSTATEDIR—both define paths that are only used as the basis for the default values of other options in config.layout. If you create your own layout that doesn’t make use of them, they have no significance.

You can also combine a layout configuration with an individual location option. The configure script reads the layout first and then overrides it with individual options. For example, you can explicitly request the Apache layout and then override the sbin directory so it’s different from the normal bin directory:

[1.3] $ ./configure --with-layout=Apache --sbindir=/usr/local/apache/sbin
[2.0] $ ./configure --enable-layout=Apache --sbindir=/usr/local/apache/sbin

As a final trick, you can actually use the variables in the layout definition as part of individual location options. For example, the --exec_prefix option can be accessed with $exec_prefix. You need to escape the dollar to prevent the shell from trying to evaluate it, so the second command in the previous code could be written more flexibly as this:

$ ./configure --enable-layout=Apache --sbindir=\$exec_prefix/sbin

You can do this for any of the values defined in config.layout, which allows you to customize any predefined layout without editing it.

To check that you’ve got everything right, use the --show-layout option:

$ ./configure --enable-layout=Apache --sbindir=\ $exec_prefix/sbin --show-layout

This also has the benefit of providing the names of the values you can use in your own modifications (by prefixing them with a $).

CAUTION This isn’t yet supported by the Apache 2 configure script.



 
 
>>> More Apache Articles          >>> More By Apress Publishing
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

APACHE ARTICLES

- Apache Unveils Cassandra 1.2
- Apache on ARM Chips? Dell and Calxeda Help M...
- The Down Side of Open Source Software
- VMware Unveils Serengeti for Apache Hadoop
- SAP Takes Steps to Improve Hadoop Integration
- Looking to Hone Apache Hadoop Skills?
- How to Install Joomla on WAMPP
- Working with XAMPP and Wordpress
- GUI Available for Apache Camel
- Reduce Server Load for Apache and PHP Websit...
- Creating a VAMP (Vista, Apache, MySQL, PHP) ...
- Putting Apache in Jail
- Containing Intrusions in Apache
- Server Limits for Apache Security
- Setting Permissions in Apache

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: