IP-Based Virtual Hosts
This alternative virtual host configuration requires the setup of multiple IPs for a ma-
chine. One instance of Apache hosts several domains, each of which is assigned a dif-
ferent IP.
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.0.10, hosting two domains on the additional IPs 192.168.0.20 and
192.168.0.30. A separate VirtualHost block is needed for every virtual server.
Example 41.3 IP-Based VirtualHost Directives
<VirtualHost 192.168.0.20>
...
</VirtualHost>
<VirtualHost 192.168.0.30>
...
</VirtualHost>
Here, VirtualHost directives are only specified for interfaces other than
192.168.0.10. When a Listen directive is also configured for 192.168.0.10,
a separate IP-based virtual host must be created to answer HTTP requests to that inter-
face—otherwise the directives found in the default server configuration (/etc/
apache2/default-server.conf) are applied.
Basic Virtual Host Configuration
At least the following directives should be present in each virtual host configuration in
order to set up a virtual host. See /etc/apache2/vhosts.d/vhost.template
for more options.
ServerName
The fully qualified domain name under which the host should be addressed.
The Apache HTTP Server
759
Need help?
Do you have a question about the LINUX ENTERPRISE SERVER 10 - INSTALLATION AND ADMINISTRATION 04-08-2006 and is the answer not in the manual?
Questions and answers