This topic has not yet been written. The content below is from the topic description.
Setting up Virtual Hosts Virtual Hosts allow your web server to respond to request from multiple domains. Using Virtual Hosts, you can have a smaller web server farm fronting a large and diverse application layer. Virtual Hosts can be setup in one of 2 different ways (or blended): Name based – Allows you to respond to multiple domains with one IP address. With this approach, you define the domain that a configuration will apply to IP based – Only one domain per IP address To setup Virtual Hosts, we will modify the httpd.conf file located at $EWS_HOME/httpd/conf Name based Example: ##Listen on all IPS, NameVirtualHost is required for name based ##virtual hosting ## NOTE IPv6 addresses must be in brackets: ## NameVirtualHost [2001:db8::a00:20ff:fea7:ccea]:80 NameVirtualHost *:80 ##If you only have one domain, you don’t need a virtual host ##As soon as you add a second, the original domain must be added as ##a virtual host ##First defined virtual host will be the default ServerName www.jboss.org ServerAlias jboss.org *.jboss.org DocumentRoot /www/jboss_org ServerName www.jboss.com DocumentRoot /www/jboss_com 2 IP based Example: ##If you only have one domain, you don’t need a virtual host ##As soon as you add a second, the original domain must be added as ##a virtual host ##First defined virtual host will be the default ServerName www.jboss.org ServerAlias jboss.org *.jboss.org DocumentRoot /www/jboss_org ServerName www.jboss.com DocumentRoot /www/jboss_com In the example below, we modified $EWS_HOME/httpd/conf/httpd.conf with the following changes, resulting in two different domains being served up from one server. DocumentRoot /home/jtosi/website1 ServerName www.site1.com ErrorLog logs/site1-error.log CustomLog logs/site1-access.log common Order allow,deny Allow from all DocumentRoot /home/jtosi/website2 ServerName www.site2.come ErrorLog logs/site2-error.log CustomLog logs/site2-access.log common Order allow,deny Allow from all Hitting the first IP in a browser: Illustration 17: Accessing first virtual host through a browser Hitting the second IP: Illustration 18: Accessing second virtual host through a browser The rest of this paper will continue expanding on one VirtualHost.