RedHat iTOps Tube

Thursday, November 17, 2011

Configure Virtual Hosting on Multiple IPs

Step 1: Configure Virtual Hosting on Multiple IPs

You can configure Apache to serve the correct content when accessing www.mysite.com or www.another-site.com from the outside, and also when accessing the specific IP address 192.168.1.100 from the inside. Fortunately Apache allows you to specify multiple IP addresses in the <VirtualHost> statements to help you overcome this problem.

Here is an example:


NameVirtualHost 192.168.1.100
NameVirtualHost 97.158.253.26

<VirtualHost 192.168.1.100 97.158.253.26>
   DocumentRoot /www/server1
   ServerName www.my-site.com
   ServerAlias bigboy, www.my-site-192-168-1-100.com
</VirtualHost>