Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Virtual Host Technology for configuration and Management of Web Server

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

There are three ways to implement virtual hosting technology:

Using different IP addresses

Take advantage of different port numbers

Use different hostnames (domain names)

Set up multiple websites with different IP addresses

This method is to set up a different IP for each website, which first requires that the Web server has multiple network cards installed, each of which uses a different IP. If there is only one network card in the web server, you can also bind multiple IP addresses to this network card. Open the local connection, and in the Advanced setting of the TCP/IP property, add another IP address of 192.168.1.15 for the server, as shown in the following figure.

Let's create a new Web site in the IIS Manager.

Select site in IIS Manager, and then select add site in the actions panel on the right.

The "site name" can be set at will, using ytvc here.

The "physical path" is the home directory of the website, which is set to c:\ ytvc.

The protocol type of the website is still http,IP address 192.168.1.15, port number 80.

After the website is created, a web page file named Default.htm is also stored in its home directory, so that the corresponding website can be accessed by entering a different IP address on the client.

This method is rarely used in practical applications, because if the server uses the public network IP, then the public network IP address is a very valuable resource, and this method undoubtedly wastes a lot of IP addresses.

Set up multiple websites using different TCP ports

This approach is to make each site still use the same IP address, but assign different port numbers to different sites. If the default website still uses the default port 80, the ytvc website changes the port to 8000.

First, delete the second IP you just added to the local connection, then select the ytvc website in [IIS Manager], click the "bind" link in the right "actions" panel, and still set the IP to 192.168.1.5 and the port to 8000.

In this way, when the client visits the default website, it can still be accessed in the form of URL "http://192.168.1.5", while if you want to visit the ytvc website, the port number cannot be omitted and must use the URL in the form of" http://192.168.1.5:8000". "

But at this time, the client cannot access the ytvc website, because the firewall on the web server automatically filters out the data sent to the TCP8000 port, you can temporarily turn off the firewall for testing, or add an inbound rule in the firewall.

Open the advanced settings of the firewall, create a new inbound rule, and select "Port" for the type of rule to be created.

Specifies that the rule applies to the TCP 8000 port.

Connections are allowed for operations that meet the conditions.

Apply this rule to all networks.

Give a random name to the rule.

After the inbound rule is created, the ytvc website can be accessed normally on port 8000 on the client side.

In this way, the client must add the corresponding port number to the URL when visiting the website, and it is impossible for the user to remember the port number of each website, so this method is rarely used in practice.

Set up multiple websites with different host headnames

The host header name is actually the URL of each website, that is, its FQDN name, so to take advantage of this method, you first need to add the corresponding zone and host record to the DNS server. Let's create a zone called ytvc.com.cn in the DNS server, and then add a host record named "www" to it, corresponding to the IP address of 192.168.1.5. (if you do not have a DNS server, you can also do domain name resolution by modifying the client's hosts file. )

Then we set the host name www.ytvc.com.cn for the ytvc website and return its port number to 80.

Then set the hostname of the default Web site to www.coolpen.net.

In this way, the client can enter different URLs to visit different websites, which is also the most commonly used and recommended way in practice, but in this way, it is impossible to access the corresponding websites through IP addresses. (in practice, many websites can be accessed with URLs, but not with IP addresses. )

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report