Most of your server configuration is done in the server configuration
files, after you have installed Apache. However, the things that you are able
to configure are largely decided when you install the server. That is, if you
don't install a particular module, then you cannot configure the things that
that module control.
In the configuration stage, before you compile your Apache server, you
decide what modules you want installed, where you want files to get put, and a
variety of other things. You can also specify various things that get set in
the server configuration files, which you can then change afterwards.
In this week's column, we'll talk about some of the things that you can do
with the configure utility, so that Apache gets installed exactly
the way that you want it.
For a basic Apache installation, using all the default settings, simply
follow the instructions that you see near the top of the
README.configure file:
tar -zxf apache_1.3.12.tar.gz
cd apache_1.3.12
./configure --prefix=PREFIX
make
make install
And of course, even that does not accept all the defaults, because we are
specifying where we want the files to be put. PREFIX is not
actually the literal string PREFIX, but is the directory under
which you want Apache installed, such as /usr/local/apache.
If you simply run configure, without providing any arguments,
Apache warns you:
Configuring for Apache, Version 1.3.12
+ Warning: Configuring Apache with default settings.
+ This is probably not what you really want.
+ Please read the README.configure and INSTALL files
+ first or at least run './configure --help' for
+ a compact summary of available options.
When we type configure --help, we get several pages of
options. Many of them will not be covered in this article, but several of them
are remarkably useful.
--show-layout
The --show-layout option tells you where Apache will put files
when it installs. Running with this option does not actually do anything, it
just figures out where everything will wind up if you did configure
with the particular options you have selected. This is particularly useful when
you are experimenting with various different configurations, and don't want to
actually install them to see what they will end up looking like.
--sysconfdir=DIR
The --sysconfdir option lets you specify where the server
configuration files will live. With a default installation, there will be a
conf subdirectory under the main server root directory, which will
contain these files. However, some folks like for all their configuration files
of any kind to be located in /etc, and so you might want to do:
./configure --sysconfigdir=/etc/httpd
--htdocsdir=DIR
--htdocsdir sets the location where web documents will be stored,
and served from. If, for example, you install Apache from the RPM (Red Hat
Package Manager) file, you will find that the document directory is located in
/home/httpd/html, while the other files are located at various
other places around the system.
There are also a number of directives like the last few, which let you set
the location of files. --iconsdir sets the location of the icon
files, --bindir and --sbindir set the locations of
the binary executables, and so on.