How to implement multiple web sites on one server

Source: Internet
Author: User
Abstract: After Windows Server is successfully installed, a default web site is generally started to provide Internet services for the entire network. In small and medium LAN, there is usually only one server, but a Web site obviously cannot meet the work needs. So can we set up multiple web sites on one server (hereinafter referred to as "one machine, multiple sites? The answer is yes, and there are multiple ways to achieve this goal. We know that each web site on the network 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. To implement "one machine, multiple sites", you need to work in these three aspects.

Now we have a windows2000server server. On this server, we need to set up the default site "Home Inn" and the new site "Student World" (the same principle for building more websites ), next we will discuss three different implementation methods.

Method 1 tcp port

We know that the default port of the web site is generally 80. If this port is changed, the purpose of adding a site on the same server can be realized.

Assume that the server name is master and a network card is installed with the IP address 192.168.0.1. After IIS is installed, a default web site is automatically generated, and we use it as the "Home of Taobao" website. Click "start"> "program"> "Administrative Tools"> "Internet Service Manager". The "Internet Information Service" window appears (see the figure below ). Right-click "Default web site" and select "properties" for setting. In "web site ID", change the description to "Home Inn", select 192.168.0.1 as the IP address, and keep the default port 80 unchanged. Copy the created website file to the default directory. The setting of "Home Inn" is complete.

Next we will add the "Student World" site. In the "Internet Information Service" window, click the selected host name master, and then select "operation"> "new"> "web site". The "web site creation wizard" window appears, click Next, set the site description to "Student World", and select 192.168.0.1 as the IP address. In the TCP port column, make sure to change the default 80 value to another value, such as 1050, and select the home directory, after the access permission is set, the "Student World" site is also set.

To test the effect, enter http: // 192.168.0.1 in the address bar of the browser (the default port number 80 can be omitted). Press enter and we will visit the site "Home of Hangzhou. Enter http: // 192.168.0.1: 1050 (note that the port number after the IP address must be small. Unfortunately, multiple sites configured in this way cannot be used with DNS.

Generally, only one IP address is set for one network card. If we bind multiple IP addresses to this network card and each IP address corresponds to a web site, we can also achieve "one machine, multiple sites.

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, select "Internet Protocol (TCP/IP)", and click "properties" to bring up the "Internet 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 confirm in sequence to complete the binding of multiple IP addresses.

Set the default site "" according to the above example, and then we will add the "Student World" site. In the "Internet Information Service" window, click the selected host name master and select "Operation>" new ">" web site ". The" web site creation wizard "window appears. Click Next in turn, set the site description to "Student Heaven and Earth", and set the IP address to 192.168.0.2 (note that it cannot be the same as the IP address of the default site). Keep the default port 80 on the TCP port, select the home directory, and set the access permission, the "Student World" site is configured.

Enter http: // 192.168.0.1 and http: // 192.168.0.2 in the address bar of the browser to test the effect. If you are not convenient enough to access the site by entering an IP address, you can simply set up DNS, use a http://www.teacher.com instead of http: // 192.168.0.1 to access "home", use a http://www.student.com instead of http: // access "Student World" at 192.168.0.2 ".

Method of three host headers

Without changing the TCP port and IP address, you can also implement "one machine and multiple sites". Here we need to use "Host header name" to distinguish different sites.

The so-called "Host header name" actually refers to a friendly website such as www.student.com. Therefore, to use the "Host Header method" to implement "one machine and multiple sites", you must first configure DNS settings. Set both http://www.teacher.com and http://www.student.com in DNS to point them to the unique IP address 192.168.0.1.

In the above two examples, we first set the default site "Home Inn". Because it is the default site, no special settings are required. Then, refer to the above two examples to add the "Student heaven and earth" site. Select 192.168.0.1 as the IP address and keep the default port 80 unchanged. Enter www.student.com as the "Host Header of this site, select the home directory and set the access permission. The "Student World" site is set.

Enter the http://www.teacher.com and http://www.student.com in the address bar of the browser to test the effect. Different from the previous two examples, the "one machine, multiple sites" implemented by the "Host Header method" must use a friendly web site to access. 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, multiple sites ".

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.