Use IIS to set virtual hosts (how to use the same port IP address to correspond to different Web applications)

Source: Internet
Author: User

We create multiple web sites on one IP address. In iis5, we may achieve this through simple settings.
In IIS, each web site has a unique identifier consisting of three parts to receive and respond to requests:
(1) IP Address
(2) Port Number
(3) Host header name.
In IIS, multiple independent web sites are created on an IP address. there are usually two methods. This article introduces the Host Header method in the form of an example, you can use this method to create a professional VM.
Environment: the IP address of the win2003server server is 192.168.1.10.iis6.
The four domain names are www.a.com, www. B .com, www.c.com, and www.d.com.
By using the Host header, the site only needs one IP address to maintain multiple sites. Customers can use different domain names to access their respective sites, and they do not feel that these sites are on the same host.
The procedure is as follows:
1. create folders for the four companies on the win2003 server as the Home Directory of the web site
2. Use the web site management Wizard to create independent web sites for each of the four companies. The biggest difference between the four companies is that they use different host headers:
Company A site Company B site Company C site Company D site
All IP addresses are bound to external IP addresses.
All TCP ports are 80
All permissions are for reading and running scripts.
Host headers are www.a.com www. B .com www.c.com www.d.com
The Home Directory of the site is D: \ WEB \ a d: \ WEB \ B D: \ WEB \ c d: \ WEB \ D

 

3. the Host header name of each site can be set in the web site creation wizard. It is on the same screen as the site IP address and TCP port. you may also click the site-> "properties"-> "Site" tag-> select "advanced" on the right of the IP address to jump out of the "advanced website ID" for configuration.
In short, the host header is used to bind a domain name
You can add multiple host headers to the properties-website-advanced of this website:
For example, we add www.im286.com bbs.im286.com www.99828.com.cn. This is how multiple domain names correspond to one application. For example, this application corresponds to the D: \ wwwroot directory.
Create the im286 imbbs 99828 directories under D: \ wwwroot respectively.
D: \ wwwroot \ im286
D: \ wwwroot \ imbbs
D: \ wwwroot/99828
In the D: \ wwwroot \ directory, create an index.htm file as follows:
Top. Location. href = "2.htm ";
Create a 2.htm file in the D: \ wwwroot \ directory as follows:
If (top. Location = "http://www.99828.com.cn/2.htm") top. Location. href = "99828/index.htm ";
If (top. Location = "http://bbs.im286.com/2.htm") top. Location. href = "imbbs/index.htm ";
If (top. Location = "http://www.im286.com/2.htm") top. Location. href = "im286/index.htm ";
Because these three domain names all point to the same directory, but their address on the browser is different location, read the address of the browser through javascripts, and then jump to the corresponding directory!

Note that if a Host header is bound to the "advanced website ID", the host cannot be accessed through an IP address. Therefore, you need to add one (this IP address is bound ). For more information, see settings on the WAP Server.

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.