Apache HTTP Server Version 1.3

Apache IP-based Virtual Host Support

System requirements

As the term IP-based indicates, the server
must have a different IP address for each IP-based
virtual host. This can be achieved by the machine
having several physical network connections, or by use of
virtual interfaces which are supported by most modern operating
systems (see system documentation for details, these are
frequently called "ip aliases", and the "ifconfig" command is
most commonly used to set them up).

How to set up Apache

There are two ways of configuring apache to support multiple
hosts. Either by running a separate httpd daemon for each
hostname, or by running a single daemon which supports all the
virtual hosts.

Use multiple daemons when:

There are security partitioning issues, such as company1
does not want anyone at company2 to be able to read their
data except via the web. In this case you would need two
daemons, each running with different User, Group, Listen, and ServerRoot
settings.

You can afford the memory and file descriptor
requirements of listening to every IP alias on the
machine. It's only possible to Listen to the "wildcard"
address, or to specific addresses. So if you have a need to
listen to a specific address for whatever reason, then you
will need to listen to all specific addresses. (Although one
httpd could listen to N-1 of the addresses, and another could
listen to the remaining address.)

Use a single daemon when:

Sharing of the httpd configuration between virtual hosts
is acceptable.

The machine services a large number of requests, and so
the performance loss in running separate daemons may be
significant.

Setting up multiple daemons

Create a separate httpd installation for each virtual host. For
each installation, use the Listen directive in the
configuration file to select which IP address (or virtual host)
that daemon services. e.g.

Listen www.smallco.com:80

It is recommended that you use an IP address instead of a
hostname (see DNS caveats).

It is recommended that you use an IP address instead of a
hostname (see DNS caveats).

Almost any configuration directive can be
put in the VirtualHost directive, with the exception of
directives that control process creation and a few other
directives. To find out if a directive can be used in the
VirtualHost directive, check the Context using the
directive index.

SECURITY: When specifying where to write log files,
be aware of some security risks which are present if anyone
other than the user that starts Apache has write access to the
directory where they are written. See the security tips document
for details.