A virtual host is used to run several networks on a server.
SiteProvides Web, FTP, mail, and other services. There are two ways to implement a VM: IP-based and host name-based. The basic IP address method is commonly used in LAN, and the host name-based method is commonly used in Internet. The following uses the two most commonly used Web Servers
IISFor example, this section describes how to set a virtual host based on the host name. After Windows 2000 Server is successfully installed, a default web
SitePoint, but a web
SitePoint is obviously unable to meet the work needs. So, can I set it on a server?
MultipleWeb
SitePoint (hereinafter referred to as "one machine"
Multiple
Site? The answer is yes, and there are
MultipleTo achieve this goal. We know that every web
SiteEach vertex has a unique identity, so that the client can access it accurately. This identifier consists of three parts: TCP port number, IP address, and host header name.
Multiple
Site"You need to work on these three aspects. Now we have a Windows 2000 Server. On this server, we need to create a default
SiteClick "001" and add
SiteClick "002" (create more
MultipleNetwork
SiteThe principle is the same). Next we will discuss three different implementation methods.
Method 1:
TCP
Port MethodWe know that Web
SiteThe default port of the vertex is generally 80. If this port is changed, it can be added to the same server.
SitePoint. Assume that the server name is master and an Nic is installed, and the IP address is 192.168.0.1.
IISA default web
SitePoint, we will use it as the "001" Network
Site. Click Start> program> Administrative Tools> inte. net service manager. The inte. Net Information Service Window appears. Right-click "Default web
SiteClick "and select" properties. In the "Web
SiteChange the description to "001", select 192.168.0.1 as the IP address, and keep the default port 80 unchanged. Set the created network
SiteCopy the file to the default directory. The setting of "001" is complete. Next we will add "002"
SitePoint. In the "inte. Net Information Service" window, click the selected host name master, and then select "operation"> "new"> "Web
SitePoint, "Web
SiteClick Create wizard, and then click [next]
SiteThe point description is set to "002", and the IP address is 192.168.0.1. In the TCP port column, make sure to change the default 80 value to another value, such as 1050, select the main directory, set the access permission, and set "002"
SitePoint settings are complete. Test the effect. Enter 192.168.0.1 in the address bar of the browser (the default port number 80 can be omitted). Press enter and we will access "001"
SitePoint. Enter 192.168.0.1: 1050 (note that the port number after the IP address must be small), "002" will appear"
SitePoint. Unfortunately, it is set in this way.
Multiple
SitePoint cannot be used with DNS.
Method 2:
IP
Address MethodGenerally, only one IP address is set for one network card. If we bind this Nic
MultipleIP addresses. Each IP address corresponds to a web
SitePoint.
Multiple
Site. Click Start> set> control panel, double-click Network and dial-up connections, and right-click local connection ", select "properties" to bring up the "Local Connection Properties" Panel and select "inte. net Protocol (TCP/IP), click "properties" to bring up "inte. net Protocol (TCP/IP) properties panel, click "advanced" below to bring up the "Advanced TCP/IP Settings" panel. The IP address and subnet mask set for the NIC are listed in the IP address bar. Click the [add] button and fill in the new IP address (for example, 192.168.0.2, note that it cannot be the same as the IP addresses of other machines. The subnet mask is the same as the original one (for example, 255.255.255.0 ). Then [OK ].
MultipleIP addresses. Set the default value according to the previous example.
SiteClick "001", and then we will add "002"
SitePoint. In the "inte. Net Information Service" window, click the selected host name master and select "Operation>" new ">" Web
SitePoint, "Web
SiteClick Create wizard, and then click [next]
SiteThe point description is set to "002", and the IP address is 192.168.0.2.
SitePoint), TCP port keeps the default 80 unchanged, select the main directory, set the access permission, "002"
SitePoint. Enter 192.168.0.1 and 192.168.0.2 in the address bar of the browser to test the effect. If you do not want to access the service by entering an IP address
SiteIf it is not convenient enough, you can set up DNS, use www.pclala.com instead of 192.168.0.1 to access "001", and use www.xrss.cn instead of 192.168.0.2 to access "002 ". For specific DNS settings, refer to only two URLs corresponding to different IP addresses.
Method 3: Host Header MethodWithout changing the TCP port and IP address
Multiple
Site", Here we need to use" Host header name "to distinguish between different
SitePoint. The so-called "Host header name" is actually a friendly website such as www.xrss.cn. Therefore, you must use the "Host Header method" to implement "one machine ".
Multiple
Site", You must first configure DNS settings. Set www.xrss.cn and www.pclala.com In the DNS to direct them to the unique IP address 192.168.0.1. First, set the default value according to the above two examples.
SiteClick "001", because it is the default
SiteTherefore, no special settings are required. Then add "002" based on the above two examples"
SiteClick the operation, select 192.168.0.1 as the IP address, and keep the default port 80 unchanged.
SiteClick "Host Header" to enter www.xrss.cn, select the main directory, and set the access permission, "002"
SitePoint.
Enter www.pclala.com and www.xrss.cn in the address bar of the browser to test the effect. Different from the previous two examples, the "Host Header method" is used to implement "one machine ".MultipleSiteYou must use a friendly website to access the website. You can use the preceding three methods as needed. If the server is installed with more than two NICs, you can also use the "ip address method" to specify different IP addresses for each Nic, thus implementing "one machine"MultipleSite".