The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.
The Apache HTTP server supports virtual hosts, meaning that it can respond to requests that are directed to multiple IP addresses or host names that correspond to the same host machine. You can configure each virtual host to provide different content and to behave differently.
You can configure virtual hosts in two ways:
IP-based Virtual Hosts (host-by-IP)
Each virtual host has its own combination of IP address and port. The server responds to the IP address with which the host name resolves. Host-by-IP is needed to server HTTPS requests because of restrictions in the SSL (Secure Sockets Layer) protocol.
Name-based Virtual Hosts (host-by-name)
All virtual hosts share a common IP address. Apache responds to the request by mapping the host name in the request to
ServerName
andServerAlias
directives for the virtual host in the configuration file.
To configure a virtual host, you use the <VirtualHost
container. You must
also divide all served content between the virtual hosts that you
configure.
hostname
>
The following example shows a simple name-based configuration for two virtual hosts:
NameVirtualHost *:80 <VirtualHost *:80> ServerName websvr1.mydom.com ServerAlias www.mydom-1.com DocumentRoot /var/www/http/websvr1 ErrorLog websvr1.error_log </VirtualHost> <VirtualHost *:80> ServerName websvr2.mydom.com ServerAlias www.mydom-2.com DocumentRoot /var/www/http/sebsvr2 ErrorLog websvr2.error_log </VirtualHost>
For more information, see http://httpd.apache.org/docs/2.2/vhosts/.