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
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
-
Open the IIS manager. For information about how to open IIS manager, see open IIS Manager (IIS 7 ).
-
In"Connection"Pane, expand"Website"Node, and then select the site for which you want to configure the Host header.
-
In"Operation"In the pane, click"Binding".
-
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.
-
In"Host name"Enter the Host header of the site, for exampleWww.contoso.com.
-
Click"OK".
-
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