In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
configure the virtual host
In order to improve the utilization of hardware resources, you can run multiple websites on a server. If you create a new website, this website and the default website use the same IP address and the same port number, then the default website will not work properly. To make multiple websites run simultaneously, virtual hosting technology must be used. Using virtual host technology can greatly save server hardware costs, it is currently the most popular, most convenient and most economical way to establish a site on the Internet.
First we need to install the web server (IIS) service.
Here we do not install FTP and other services, if necessary, you can install,
When we want to install FTP and other services after installation, you can find the services we need to install on the Task Manager page below.
After installation, open the service as shown in the figure
After opening, the following page will be displayed. By default, there is a website.
Because we want multiple websites running simultaneously, we want to create a new website, here we create two websites instead of using the default website.
Virtual hosting technology can be implemented in three different ways
1. Using different TCP ports to set up multiple websites
This method is to let each website still use the same IP address, but assign different port numbers to different websites.
The two websites are wzg and wzg1. The two ports created are different. wzg uses port 80 and wzg1 uses port 8080.
Because I don't have DNS installed here, I'll add two records to the hosts file first, which can still be accessed through the URL"http://170.130.1.6", but I use the domain name to access web2, then the port cannot be omitted.
The domain name for visiting wzg is www.wzg.com , and the domain name for visiting wzg1 is www.wzg1.com
Here visit, show success (here two websites directory below I put two very simple pages written by myself)
In this way, the client must add the corresponding port number after the URL when accessing the website. It is impossible for the user to remember the port number of each website, so this method is rarely used in practice.
2. Multiple websites using different IP addresses
This method is to set up a different IP for each website. To adopt this method, you first need to install multiple network cards on the Web server, and each network card 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 add an IP address of 170.130.2.6 to the server in the Advanced settings of TCP/IP properties.
Then, in IIS Manager, assign the two websites to different IP addresses, select wzg website, select Bind in the Operation panel on the right, bind the website to IP address 170.130.1.6, and also bind IP address 170.130.2.6 in wzg1. Note that the ports here are the same.
Then verify the correctness of the experiment by accessing different domain names
WZG succeeded.
wzg1 is also successful, here is the explanation that our configuration is not a problem
This method is rarely used in practical applications, because if the server uses a public network I, then the public network IP address is a very valuable resource, and this method will undoubtedly waste a lot of IP addresses.
3. Set up multiple websites with different host headers
The host header name is actually the URL of each website, that is, its FQDN name, so to use this method, you first need to add the corresponding zone and host record in the DNS server. Here I will use the hosts file first. Note that the IP address and port number here are the same.
Finally, wzg can be successfully accessed by verifying the domain name.
Verification wzg1, also can be successfully accessed, the experiment is completed
This allows clients to access different websites by entering different URLs, which is also the most often used and recommended way in practice, but this way cannot access the responding website through IP address. In practice, many websites can be accessed using URLs, but cannot be accessed using IP addresses.
I am also a white, a learner, if there are mistakes in the article, I hope you point out that we learn together.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.