Configure the Host header of the website (IIS 7)

Source: Internet
Author: User

The Host Header, also known as a domain name or host name, allows multiple sites to be assigned to one IP address on the Web server.

Recommended topic: "lecture hall" of IIS service"

Remarks
The Host header is applicable to browsers that comply with HTTP 1.1 standards, Internet Explorer 3.x and later, or Netscape Navigator 3.x and later ).

To host multiple websites on a Web server, you can assign a unique IP address to each website, specify a non-standard TCP port number for the website, or use the Host header. Among the three methods, it is more common to use the host header.

Remarks
After configuring one or more host headers for IP addresses, you must register them in the appropriate name resolution system. If the computer is on the Intranet, resolve the Host header name to the Intranet name. If your computer is on the Internet, register the Host header name with the Domain Name System (DNS) managed by InterNic.

Prerequisites

For information about the levels at which you can perform this process and the modules, handlers, and permissions required to perform this process, see site functional requirements (IIS 7 ).

Exception in functional requirements

  • None
Configure the Host header of the site

You can run the following procedure: Use the user interface (UI), run the Appcmd.exe command in the command line window, edit the configuration file directly, or write a WMI script.

UI
  1. Open the IIS manager. For information about how to open IIS manager, see open IIS Manager (IIS 7 ).

  2. In"Connection"Pane, expand"Website"Node, and then select the site for which you want to configure the Host header.

  3. In"Operation"In the pane, click"Binding".

  4. In"Website binding"In the dialog box, select the bind host header for it, and then click"Edit"Or"Add"To add a new binding with a Host header.

  5. In"Host name"Enter the Host header of the site, for exampleWww.contoso.com.

  6. Click"OK".

  7. To add other host headers, create a new binding with the same IP address and port, and then create a new host header. Repeat this process for each host header that uses this IP address and port.

Command Line

To add a Host header to a website binding, use the following syntax:

Appcmd set site/site. name: String /Bindings. [protocol =' String ', BindingInformation =' String ']. BindingInformation: String

VariableSite. name StringIs the name of the site to add the Host header. Variable [Protocol ='String', BindingInformation ='String']Is an existing binding to the Host Header,BindingInformation StringIs a new binding with a Host header.

For example, assume that there isContosoThe existing HTTPS binding of all its IP addresses uses port 443 without the Host header. To configureMarketingIn the command prompt, type the following command, and then press Enter:

Appcmd set site/site. name: Contoso /Bindings. [protocol = 'https', bindingInformation = '*: 443:']. bindingInformation: *: 443: Marketing

For more information about Appcmd.exe, see Appcmd.exe (IIS 7 ).

Configuration

The process in this topic affects the following configuration elements:

<Site>Element<Bindings>

For more information about IIS 7 configuration, see IIS 7.0: the IIS setting architecture may be in English on MSDN ).

WMI

Use the following WMI classes, methods, or attributes to execute this process:

  • Site. BindingsAttribute
  • BindingElement. BindingInformationAttribute

For more information about WMI and IIS, see Windows Management Instrumentation (WMI) in IIS 7 ). For more information about the classes, methods, or attributes associated with this process, refer to the iis wmi provider reference on the MSDN website, which may be an English page ).

Original article address

View more articles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.