Using Host Header Names to Host Multiple Web Sites

Applies To: Windows Server 2003, Windows Server 2003 with SP1

IIS supports multiple Web sites on a single server. To create and host multiple Web sites, you must configure a unique identity for each site on the server. To assign a unique identity, distinguish each Web site with at least one of three unique identifiers: a host header name, an IP address, or a TCP port number.

One method for providing each site with a unique identifier is to use IIS Manager to assign multiple host header names. Browsers must comply with HTTP 1.1 to support the use of host header names. Microsoft® Internet Explorer 3.0, Netscape Navigator 2.0, and later versions of both browsers support host header names.

Important

Avoid assigning a host header name to the Default Web Site; instead, use an IP address of All Unassigned, a TCP port of 80, and no host header name.

Table A.4 briefly describes and compares the three ways that you can uniquely identify your Web sites.

Table A.4 Ways You Can Uniquely Identify Multiple Web Sites

Web Site Identifier Description

Host header name

Recommended for most situations. Requires that your computer or network use a name resolution system. Organizations typically use DNS name resolution.

Unique IP Address

Used primarily for Internet services that host SSL on the local server. Typically, only large corporations and Internet service providers (ISPs) obtain and maintain multiple IP addresses.

Nonstandard TCP port number

Generally not recommended. Can be used for private Web site development and testing purposes but rarely used on production Web servers because users must add the port to the URL and the port must be opened on the firewall.

Choose one method of uniquely identifying Web sites for each server. Using one method for each server improves performance by optimizing cache and routing lookups. Conversely, using any combination of host headers, unique IP addresses, or non-standard port numbers to identify multiple Web sites degrades the performance of all Web sites on the server.

If you use host header names to identify a new Web site, select a unique name as follows:

  • On the Internet. The host header must be a publicly available DNS name, such as support.microsoft.com. Register a public DNS name with an authorized Internet name authority. For more information about using DNS names to identify your site, see Domain Name Resolution in the IIS 6.0 Operations Guide, which is accessible from IIS Manager.

  • On a private network. The host header can be an intranet site name. To resolve host names to an IP address, register the host header name with your intranets DNS administrator. Alternatively, you can resolve host names to an IP address by using a locally stored database file called the Hosts file, which is located in the systemroot\System32\Drivers\Etc folder. The following is an example of the contents of a Hosts file:

    # Table of IP addresses and host names
    # IP Address     TCP Port   Host Header Name
    192.168.0.100    80         www.example1.com
    192.168.0.100    80         example1.com
    

Use Windows Explorer to create a home directory for your Web site content. Create subdirectories to store HTML pages, image files, and other content as needed. To organize home directories for multiple Web sites on the same server, you can create a top-level directory for storing all home directories, and then create subdirectories for each site.

Important   You must be a member of the Administrators group on the local computer to perform the following procedure or procedures. As a security best practice, log on to your computer by using an account that is not in the Administrators group, and then use the runas command to run IIS Manager as an administrator. At a command prompt, type **runas /user:**Administrative_AccountName "mmc %systemroot%\system32\inetsrv\iis.msc".

To assign multiple host header names to a single Web site

  1. In IIS Manager, expand the local computer, click the Web Sites folder, right-click the Web site for which you want to assign a host header name, and then click Properties.

  2. Click the Web Site tab.

  3. In the IP Addresslist, select the IP address that you want assigned to this Web site.

  4. Click Advanced.

  5. Under Multiple identities for this Web Site, select the IP address, and then click Edit.

  6. In the Host Header Value box, type the host header name (for example, www.contoso.com).

  7. Click OK twice.

For more information about using host header names to host multiple Web sites, see Hosting Multiple Web Sites on a Single Server. Also see Knowledge Base article 324287, Use Host Header Names to Configure Multiple Web Sites in Internet Information Services 6.0.