Sep 18, 2009

Creating multiple websites on a single IP ...

Suppose, I have a couple of websites hosted on a dedicated server (Windows 2003 with IIs 6.0) and the issue is that with one IP address (in other words - Static/Dedicated IP address), I was able to reach only one of the websites.

There are three options to host multiple websites in IIS :

1. Create websites, each assigned an IP - The downside of this option is that you will have limited IPs with you !!
2. Create websites, each listening on different port numbers.For example, http://mysite1.com and http://mysite2.com:8888 - The downside of this approach is that users have to remember the port number of the site that they are interested in!!
3. Using Host-Headers - This option is the "best" that solves the problem at hand.

Let me elaborate a bit on option #3 here:

1. Create multiple websites in IIS
2. Right click on a website, choose "Properties".
3. On the tab page named "Website" click "Advanced ..." and here you can add a host header (say, mysite2.com) and let all the websites have the IP as "All Unassigned" and the port 80.

Having done this, update the DNS records for mysite1.com and mysite2.com to point to the IP running your webserver and try accessing mysite1.com and mysite2.com, it works :-)

For more details, please visit http://www.iisanswers.com/Top10FAQ/t10-hostheaders.htm

No comments:

Post a Comment