Most web developers are not aware that IIS can host multiple websites on a single ip address. Here is some help on how to do that.
You have two available options to do the same. One is to assign different port numbers to each of the websites (which i don't recommend). The second option is to use host headers. By using host headers we assign domain names to the websites hosted on iis. For example if you have two websites on iis both sharing a single ip, then you can set two different host headers(abc.com and xyz.com) for them. then you will be able to browse both the websites with the domain names specified. when you request for the web page at www.abc.com, the request is sent to iis and iis will resolve the host header(abc.com) and route it to the corresponding website.
Lets have a look on how to implement it.
- Go to iis mmc (enter inetmgr in the run window and click ok) click here for more Run window shortcuts
- Right click on the website and select properties.
- Select the Websites tab and click on Advanced.
- On this screen , Edit the default entry and delete the All Unassigned entry and enter the ipaddress of your site.
- specify the TCP Port [let it be 80]
- The third entry is the (much awaited) Host Header.
- Enter the exact string that you want the website to respond to. If you want the site to respond to www.abc.com give that as the host header. You can make multiple entries in this window. if you want the same site to respond to www.thisisalsoabc.com then add that also as the next entry. Make sure you give the same ip address and port number.
Thats It and you are ready with your website with host headers enabled.
Now you can configure your other sites and give different host headers to them. Make sure you enter the same ip address and port number for them too.
Now you can browse your websites with the host header names.
Please Note that these host headers has to be registered with some naming servers. ie you have to register your website name to map to youir ip address from a name resolution system. In case you are on the local intranet Please edit the hosts file to do the same.
The hosts file is a file located on each Windows machine and is used to resolve names to an IP address, and this file can be modified to resolve any valid name to an IP address.
Here is howyou can edit the hosts file.
- The hosts file is located in the \system32\drivers\etc directory and can be opened with Notepad.
- You can see that the last line maps an ip to localhost
- Press enter to start a new line after that and enter the ipaddress of the iis machine followed by a tab and enter the host header name.
- you can make multiple entries to map each of the host headers to the ipaddress.
- Save the file (make sure that notepad is not adding the .txt extension)
Now you are ready to browse the websites with the hostheader on your local network. If you want to browse the site from different machines on the intranet , you have to edit the hosts file on each machine. If you are on a larger network you can rely on your DNS server to handle host headers.
Hope this post helps you...
8 comments:
why can't I leave the IP address as "All Unassigned"?
If I have DNS configure to point to my IP address, then I don't need to configure the hosts file. One or the other?
Hi Cheeky Monk,
If you have your DNS Configured, then you don't need to edit the hosts file. And you need to specify the ip address for host headers to work.
Happy Programming,
I think the second option host headersis better whats your opinion on it.
Web hosting India
Hi Adrin,
Sure, the second option is the recommended one.
Happy Programming,
What a good blog you have here. Please update it more often. This topics is my interest. Thank you.
Website Hosting
This is a great post. It’s Very informative and well writing.
catheter supplies Chicago
This is a great post. It’s Very informative and well writing.
Cheap divorce lawyer Portland
This is a great post. It’s Very informative and well writing.
moving blankets
Post a Comment