Now, we browse the web has become a norm, but do you know how the web works?
When we browse the web, we first open the browser, and then enter the address of the webpage (of course, we don’t need to enter the address by ourselves now, usually we just search for keywords directly, and the text or picture we clicked is actually our webpage address) After the address input is completed, our client, that is, our browser, connects to the server corresponding to this address, and tells the server the page we visit, and the server then feeds back the page to our browser, and then we can see to the content of the page
So do you want to build a website yourself? Your own website, if you want it, then continue reading! ! !
Today Xiaoxing brings you the following content. Completing the first three items means that you have been able to build your own website! ! !
1. Install the web server
2. Create a new web site
3. Clients access the web site
4. Configure a web site with a port other than 80
Of course, my following demonstrations are all performed in Windows server 2012 installed on a virtual machine! ! !
Let's start with the first task: installing the web server.
First of all, we first click "Service Manager" in the lower left corner to open the Service Manager window, and then click "Add Roles and Functions", as shown in the figure below: Before starting
this interface, just click Next, and then we can also check the Select "Skip this page by default", and this interface will be gone when we add roles and functions next time:
In the installation type interface, we check "Role-based or function-based installation", and then click Next, As shown in the figure below:
In the server selection window, check "Select a server from the server pool", which is our default option, just continue to the next step:
because we want to add a Web server, so we check the "Web server (IIS)", and then a wizard window for adding roles and functions will pop up, check Include Management Tools, and then click Add Function: After adding the function, there should
be a tick in front of the Web server (IIS) (here is a screenshot before adding The picture, so there is no tick) and then click Next:
In the function selection interface, we keep the default settings, just continue to the next step:
Now we have entered the Web server role (IIS) interface, here is also the next step:
Arrived Our selection role service window cannot be defaulted here. We check "IP and Domain Restrictions" and "Windows Authentication" and continue to the next step, as shown in the figure below: Finally, enter the confirmation installation selection to see if it
is After reading the things we need, we can click "Install" to install: the
installation of our Web service is now installed, as shown in the figure below, and then we click Close.
We have completed the first task, and then we will complete the second task, creating a new website.
The website must display content, so let's write a very simple webpage first! ! ! Let's go to our resource manager first, create a new folder as the place where we store web files:
then right-click our blank space, and create a new text document:
I named my new document xiaoxing, but now you will We found that we can’t see the file extension. Now I will demonstrate how to display the file extension (some friends should know it). Let’s click View in the upper left corner: check the
file extension, as shown in the figure below:
Check After the selection, the suffix of the file will come out, the suffix is txt:
Now we type a few words in the txt file, and we can see these words when we browse the web, as shown in the figure below:
Of course Remember to save after typing, and then, we have to change the extension of the file (that is, the suffix I said) because the suffix of our web page file is html, so we select the file, and then press F2 on the keyboard key, you can rename it, just change it to html, and you can see that the icon of our file has changed, as shown in the figure below: Now our file has been
completed, and then we will start to create our website! ! !
Or enter our server manager, then we click on the tool in the upper left corner, and then click on the Internet Information Services (IIS) manager, as shown in the figure below:
we click on WIN-F2D49... , mainly because the name displayed here is different) Then we will pop up the Internet Information Services (IIS) manager window, we check "Do not display this message", click No, it will not be displayed again next time Yes, as shown in the figure below:
After clicking open, we right-click the website and click Add Website:
Enter the website name, I entered xiaoxing here, and then click the points in my box to select the physical path of our website, which is what we just said The Web folder created before:
find it, select it, and then click OK, as shown in the figure below:
Then we enter the IP address, the IP address is the IP address of our server, here is 192.168.48.134, check it Start the website immediately, and then click Confirm:
our website is created here, the name is xiaoxing, as shown in the picture below, click the browse 192.168.48.134:80 in the lower right corner to see how the website looks like (of course, it must be displayed here The same, because our IP addresses are different)
When you get here, you will find a problem, the website will report an error, and it cannot be displayed directly. Why is this?
This is because we did not add the file we just created to the default document of the website. We double-click the website xiaoxing, then find the default document, and click the default document: click Add in the upper right corner, and enter the name of the webpage document we just created, as
follows As shown in the picture, finally click OK:
double-click our xiaoxing again to return to the homepage of xiaoxing, click our browse again:
now we can visit the website we created, but this is the visit on this machine:
Now let's complete the third task, accessing the Web site on the client side
We open a browser on our computer and enter the IP address just now to see if we can access it. Of course, I can definitely access it because my computer can ping the IP address of the server. If you don’t believe me, look:
If If you can’t access it, first check if your computer can ping your server. If the ping fails, it’s a problem with the IP address. Just set the virtual machine to bridge or NAT mode. If the ping is successful and the access cannot be accessed, it is a problem with your settings (problems with firewalls)
Is the third task very simple? In fact, it is just to test whether you can access it. If you have completed these three tasks, then you can already build a very simple website (if you think it helps you, you can comment Please leave a message and let me know that someone has learned a new skill with my help)
Now let's go to the fourth task, because the default port of our webpage is 80, so let's change the port of the website to port 160 and try it out! ! !
Let's change the xiaoxing website, double-click it, and then click Binding in the upper right corner:
select the only one, and then click Edit, or double-click directly, as shown in the figure below:
Change the port to 160, and then click OK La:
In this way, our port has been changed, and we can still see our webpage when we return to direct browsing:
But now I refresh the webpage on my computer, it is not the webpage I just created:
Why is this?
Now the displayed web page is the default web page when we add the web server. Didn’t you just say that the default port of the web page is 80, so we can’t access our web page on port 160. We only need to add after this IP address Our port is fine:
this is the whole process of how to configure a Web site that is not port 80, isn't it also very simple! ! !
Then we can also control the access rights of our client, and we can set up access to the Web site for identity verification. If you are interested, you can do your own research. Writing an article is really time-consuming, so I won’t talk about it here.
Still the same sentence, your attention, likes and browsing are the biggest motivation for me to write articles! ! !