This page contains information on how to set virtual hosts with the Apache HTTP daemon on UN*X. For more information, please refer to the Apache virtual hosts documentation .
Relevant or useful links.
Configuration.
Version Apache HTTP 1.3.x OS Any UN*X OS (including Linux, Digital UNIX, etc.)Summary.
Apache provides two methods to implement virtual hosts: an IP-based one,
and a name-based one.
IP-based VH: a unique IP address is necessary for every virtual host. This (often) requires OS-level modification, such as recompiling the kernel to enable multiple IP support, editing system files, etc. Name-based VH: no need to tweak the OS, no additional hardware or software. Apache can handle unlimited number of VHs, easy to configure.
Putting it all together.
Here are step-by-step instructions:
NameVirtualHost IPADDRESS
<VirtualHost IPADDRESS> ServerName NEWSERVERNAME --all directives go here-- </VirtualHost>If a vhost has no ServerAdmin, ResourceConfig, AccessConfig, Timeout, KeepAliveTimeout, KeepAlive, MaxKeepAliveRequests, or SendBufferSize directive then the respective value is inherited from the main_server. (That is, inherited from whatever the final setting of that value is in the main_server.)
Let's say that the server running Apache is main.business.com with an IP address 190.68.10.1. You have registered blue.com and red.com, and made sure that both of them point at the above IP address (see Domain Name Service documentation or contact your system administrator). The goal is to have main.business.com accept and serve incoming requests for blue.com and red.com. Here is an example of name virtual hosts in action:
NameVirtualHost 190.68.10.1 <VirtualHost 190.68.10.1> ServerName blue.com ServerAlias blue.com *.blue.com DocumentRoot /htdocs/blue <VirtualHost> <VirtualHost 190.68.10.1> ServerName red.com ServerAlias red.com *.red.com DocumentRoot /htdocs/red <VirtualHost>Any virtual-host-specific directives, like rewrite engine statements, ScriptAlias, possibly error handling (if you want your server to display a different error depending on what name is being accessed by the client) need to be inside of