The physical server must have one IP address for each IP-based virtual host. If the
machine does not have multiple network cards, virtual network interfaces (IP aliasing)
can also be used.
The following example shows Apache running on a machine with the IP
192.168.3.100, hosting two domains on the additional IPs 192.168.3.101 and
192.168.3.102. A separate VirtualHost block is needed for every virtual
server.
Example 20.3:
IP-Based VirtualHost Directives
<VirtualHost 192.168.3.101>
...
</VirtualHost>
<VirtualHost 192.168.3.102>
...
</VirtualHost>
Here, VirtualHost directives are only specied for interfaces other than
192.168.3.100. When a Listen directive is also congured for
192.168.3.100, a separate IP-based virtual host must be created to answer HTTP
requests to that interface—otherwise the directives found in the default server congu-
ration (/etc/apache2/default-server.conf) are applied.
Basic Virtual Host Conguration
At least the following directives should be present in each virtual host conguration in
order to set up a virtual host. See /etc/apache2/vhosts.d/vhost.template
for more options.
ServerName
The fully qualied domain name under which the host should be addressed.
DocumentRoot
Path to the directory from which Apache should serve les for this host. For secu-
rity reasons, access to the entire le system is forbidden by default, so you must
explicitly unlock this directory within a Directory container.
ServerAdmin
E-mail address of the server administrator. This address is, for example, shown on
error pages Apache creates.
368 Reference