How to Create Multiple Websites with one IP address

There are three, count ‘em three ways to create multiple websites on IIS 4 and 5. First way is to use an unique IP for each site. This is ideal but if you haven’t looked around lately, IP addresses can be sorta scarce (that is of course unless your Harley Davidson or Apple both of whom own a Class A address).

The second way allows you to create multiple IP’s on one address by designating a non-standard TCP port number for the designated web to use. This is the way the Administrative website winds up on the same installation as the default website and both can be accessed. However, you have to designate the unique port number in the URL when accessing it. So instead of www.myvirtualsite.com, it becomes www.myvirtualsite.com:6160 or some other number. You can include the port number in a url so it’s really not problem for web pages to reference port designated web sites. The problem is that you can’s specify a port in a DNS server so if users want to lookup your website, they won’t be able to get to it.

Thus we come the next best thing, host headers.

The good news is this is relatively easy to do in IIS and it works very well. There is virtually no performance penalty and it works with most every browser in use today (browsers must be HTTP 1.1 compliant). You can use DNS to point to the website so internet users can find your host header designate site with no problems. You do have to pay attention to the details however or it won’t work. The biggest downside is that you compromised using SSL. (Microsoft KB Article: Q187504 – IIS: HTTP 1.1 Host Headers Not Supported When Using SSL)

Step 1: Goto the Advanced button.
In the MMC, goto the website you to access using Host Headers and right click the Web Site and select properties. One the website page, you’ll see and “Advanced” button. That’s where we go next so click that. You’ll notice the distinct absence of any clue that this is where you do host headers.
HH_Advancedwindow.gif
Step 2: Get rid of the (All Unassigned) entry (if present)!
This is where most people make their mistake. This entry tells IIS to respond to all requests to the webs server with this website. This is the same entry by default as that of the Default Web Site so you can’t create this unless the default web site is stopped, which it is on a lot of sites that use host headers.

Step 3: Add the entries you want.
This is where you select the IP address (I usually select one so if in the future, I add another IP address to the server, the website isn’t listening on that address.), port (an entry is required – usually 80), and the infamous host header information. In the Host Header Name field, enter the exact name you want the website to respond to. If your website’s name is www.coolestsiteonearth.com then that’s what you enter. Press Add.
TIP: You can make more than one entry here! Also enter coolestsiteonearth.com and your site will respond to that also.

That’s it! You should probably stop and start the web site to reload the new entries.

You can access your site from a browser using the host header name. If you can’t access your host header web, but can ping your IIS server, then most likely you need to enter your new website name in a DNS server that your browser can access. If you can’t do that right away, you can always update the HOSTS file on your development PC to map the host header name to the IIS server IP address.

LINK

Deixe um comentário

O seu endereço de email não será publicado. Campos obrigatórios marcados com *