Building web Server under server2016 & three kinds of Virtual Host experiment of
Set up web server
There are three ways to build a web server:
1. Based on IP address
2. Based on port number (default port 80, which can be modified)
3. Based on hostname (dns, hosts)
First of all, determine the installation of the web service. If it is not installed, you can follow the demonstration below.
This lab is based on windows server 2016.
Open Select Server Manager Select Server role web Server Select next and complete the installation.
After waiting a moment to complete the installation, open the internet informationservices (iis) Manager
After opening it, right-click on the website to add the website you want to add, you can add several more.
It should be noted that only the following format files are recognized by default, otherwise you have to add them manually.
Fill in the required website name and content directory
As mentioned at the beginning, there are three ways to implement this method based on IP address first.
Experiment one
Based on the IP address, different websites can have different IP addresses, but the corresponding network cards are required to assign their own IP.
For example, my network card one assigned 192.168.5.55 and the second network card assigned 192.168.5.11 corresponding to a website and b website respectively.
Modify the names and physical paths and IP addresses of websites an and b as shown in the figure below.
Confirm and start the website after the modification is completed
Let's take a look at the effect.
A website
B website
Experiment two
-implementation based on port number
In some cases, multiple IP cannot be allocated, so it is necessary to run multiple websites on the same server based on the port number.
Add two websites in the same way, but choose the same IP address and different port number when adding
If the port number of a website is 80 b by default, the website is 8080.
A website effect
B website effect
Experiment 3
-based on hostnam
Based on the hostname, there are also two ways: dns and modify hosts.
Because there is no dns in the experimental environment, it can only be realized by modifying hosts.
Modify hosts on this machine and add the IP address and hostname corresponding to a website and b website
Use ping to detect whether it is accessible, and if the returned data is resolved to the IP address, it is feasible.