Three ways to run simultaneously on a single server multiple Web sites WEB

lab environment:

Before doing the experiment we first prepared at the experimental environment, first, the original operating system a clean Windows Server 2008 R2 as a WEB server on a virtual machine, ip address 192.168.100.10 set
steps and then install the web server:
1. first add server Manager role, select the Web server (IIS) server role in the role, as shown in FIG:
Three ways to run simultaneously on a single server multiple Web sites WEB
2.IIS7.5 40 is divided into a plurality of different functional modules, the administrator can customize the installation according to the respective needs function modules, which can make the surface of your Web site by *** reduction, security and performance greatly improved. Therefore, the "default setting Select Role Services step, only the most basic modules are installed" in the figure:
Three ways to run simultaneously on a single server multiple Web sites WEB
3. After installation is complete, you can manage IIS Web site management tool in the "Internet Information Services (IIS) Manager" open the IE browser, enter the ip address of the Web server in the address bar when you can chart shown below appears indicating that the installation was successful.

Three ways to run simultaneously on a single server multiple Web sites WEB
(In order to solve the problem can not be run at the same site)
Web server After installation, the next start of our first experiment.

Purpose: to run together on one card multiple sites by setting a different port number to the site

Experimental procedure:
1. First, the C drive (or elsewhere) are new folder named two sdp and ytvc, respectively, and then written into the page prior to, and are 1.html 2.html

2. Then click on the bottom left to start -> then select the Server Management Tools -> then open Internet Information Services (IIS) Manager and configure the Web server on this interface

3. In this interface, two new sites were sdp and ytvc pointing to these two sites folder, do not assign an IP address to them, the other are the same port number is not the same, here we sdp port number is set to 8000 , the ytvc port number to 80.

FIG Example:
Three ways to run simultaneously on a single server multiple Web sites WEB

Three ways to run simultaneously on a single server multiple Web sites WEB
4.修改hosts文件
在所有已装好的Windows系统中都已经默认自带了hosts文件,位置在"%SystemRoot%system32\drivers\etc\host"。可以通过记事本打开hosts文件。然后添加两条记录分别为192.168.100.10 www.ytvc.com 和192.168.100.10 www.sdp.com 。
如下图所示:
Three ways to run simultaneously on a single server multiple Web sites WEB
5.然后打开浏览器首先访问ytvc,在地址栏中输入www.ytvc.com (因为http协议的默认端口号是80,所以访问时不用加端口号),发现成功输出网页界面
Three ways to run simultaneously on a single server multiple Web sites WEB
6.再打开浏览器访问sdp,在地址栏中输入www.sdp.com:8000, 发现访问页面成功。
Three ways to run simultaneously on a single server multiple Web sites WEB
7.最后证明实验成功

接下来我们来进行第二个实验:
实验目的:通过给网站设置相同的端口号但是设置不同的ip地址来实现一个网卡上同时运行多个网站
1.首先在C盘(或者其他地方)新建两个文件夹分别取名为sdp 和 ytvc,然后分别放进去事先写好的网页,分别为1.html和2.html

2.然后点击左下方的开始——>然后选择服务器管理工具——>然后打开Internet信息服务(IIS)管理器且在此界面对Web服务器进行配置

3..在此界面新建两个网站分别为sdp和ytvc分别指向这两个网站的文件夹,给他们设置相同的端口号但是不同的ip地址。

(网站ytvc的设置,IP地址为192.168.100.10)
Three ways to run simultaneously on a single server multiple Web sites WEB
(网站sdp的设置,IP地址为192.168.100.20)
Three ways to run simultaneously on a single server multiple Web sites WEB
4.这时需要给网卡上分别添加上这两个网站的ip地址。

5.修改hosts文件
在"%SystemRoot%system32\drivers\etc\host"。可以通过记事本打开hosts文件。然后添加两条记录分别为192.168.100.10 www.ytvc.com 和192.168.100.20 www.sdp.com 。
Three ways to run simultaneously on a single server multiple Web sites WEB

6.然后打开浏览器首先访问ytvc,在地址栏中输入http://192.168.100.10, 发现成功访问网页界面
Three ways to run simultaneously on a single server multiple Web sites WEB

7.打开浏览器访问sdp,在地址栏中输入http://192.168.100.20, 发现成功访问页面。

Three ways to run simultaneously on a single server multiple Web sites WEB

8.结论正确,实验成功

接下来进行我们的第三个实验(主机头法)

实验目的:用DNS服务器解析

1.这种方法我们就需要一台DNS服务器来协助完成实验,我们首先准备一台原始的干净的虚拟机,并且安装上DNS服务器,然后给DNS服务器的地址设为192.168.100.1,安装结束后测试DNS服务器与WEB服务器的连通性,保证能够相互ping通。

2.然后点击左下方的开始——>然后选择服务器管理工具——>然后打开DNS管理器且在此界面对DNS服务器进行配置

3.在正向查找区域中新建两个主要区域
Three ways to run simultaneously on a single server multiple Web sites WEB

4.第一个区域名称为ytvc.com,然后直至创建完成。
Three ways to run simultaneously on a single server multiple Web sites WEB

5.然后右击新建的这个区域,新建主机,主机头为www,IP地址为WEB服务器的IP地址即192.168.100.10。然后点击添加主机配置完成。

Three ways to run simultaneously on a single server multiple Web sites WEB

6.然后创建第二个主要区域 www.sdp.com 跟上述步骤一样,要注意新建主机时指向的时同一个ip地址。

7.接下来配置WEB服务器,这时我们首先需要将WEB服务器的首选DNS设置为DNS服务器的IP地址。

8.首先在C盘(或者其他地方)新建两个文件夹分别取名为sdp 和 ytvc,然后分别放进去事先写好的网页,分别为1.html和2.html

9. Then click to start the bottom left -> then select the Server Management Tools -> then open Internet Information Services (IIS) Manager and in this interface to configure the Web server
10. First, add a site ytvc, this time to set up the host header www, do not assign IP addresses
Three ways to run simultaneously on a single server multiple Web sites WEB
11. Add site sdp, also located on the host head www, do not assign IP addresses.
Three ways to run simultaneously on a single server multiple Web sites WEB
12. built sites were also added to the default document on both sites need to access the file name

13. Finally prepare a client, the address for the ip address 192.168.100.2 DNS Preferred DNS server, and test the client and server connectivity and WWEB DNS server, guaranteed to ping each other, and then re-open IE first address bar www.ytvc.com, found to be able to successfully access the page.

Three ways to run simultaneously on a single server multiple Web sites WEB
14. re-open the IE browser input www.sdp.com, found that it is possible to successfully access the page.
Three ways to run simultaneously on a single server multiple Web sites WEB
15. The experiment was a success

Guess you like

Origin blog.51cto.com/13716158/2409748