Creating a virtual host
An Apache server can host multiple websites at the same time. Each website can be hosted on a separate IP address if your server has multiple network interfaces, but more commonly all websites share the same IP address and are distinguished by the domain name associated with the site.
Note
The ability of a single web server to host multiple websites in different domains from the same IP address is an aspect of the HTTP protocol. When you type in the URL http://example.com
into your address bar, the browser looks up the IP address of the server associated with the example.com
domain and opens a connection to port 80 of a server at that IP. The name of the web host (example.com
) is passed as the Host:
header of the request.
A single Apache instance can support multiple configurations. The server checks the IP and Host:
header of every incoming request and decides which configuration to use based on this information. If you have a special configuration (virtual host) associated...