【Build IIS Website Tutorial】


1. Build an IIS website

1. Configure IIS in Windows Server 2008,
open the server manager, role, add role, and then click Next

Choose to install web server iis

Select role service

click to install
insert image description here

For testing http://127.0.0.1
insert image description here

Add an ASP application
insert image description here
and then confirm the installation

Put the site's source code on disk
insert image description here

Add a site and set it up
insert image description here

Find the clash you want to access in the application pool and modify it
insert image description here

Create a new "index.asp" under the default document
insert image description here


insert image description here
"Start" to modify the website application pool in the directory browsing , and forgot to modify it when setting up the website
insert image description here

Start under "ASP"
insert image description here

There may be some problems when building a website for the first time, and we may be prompted to add iis permissions to the website directory
Site Directory
Each website corresponds to a directory, and add IUSR and IIS_IUSRS permissions to this website directory

For example, I created an IIS directory under the root directory of the D disk, and then created a yidacms directory in it. My website program is placed in this directory. Among them, iis only needs to continue to save the permissions of the d drive, and for the yidacms directory, we need to add two more permissions, namely IUSR and IIS_IUSRS.
insert image description here

finally accessible website
insert image description here

Two, http redirection

First install the http redirection function
insert image description here
to redirect to Baidu
insert image description here

When we visit http://10.40.2.20 again, we will be redirected to Baidu's homepage

Three, virtual directory

The virtual directory is to integrate some scattered folders in the hard disk and then mount them under the main directory folder of the website. Users can access the mounted folders by using the method of visiting the website + virtual directory to access the files according to the path
insert image description here
insert image description here
.

Fourth, use the domain name to access the website

Because IP addresses are not easy to remember, users are more accustomed to using domain names to access websites; we can use domain names to access websites by creating host records for websites on the DNS server. First, after installing the dns service, you need to create a new zone
wizard
insert image description here
insert image description here

Subsequent default can be used, and then create a new host
insert image description here
cmd domain name resolution successfully
insert image description here

finally accessible website
insert image description here

5. Website Security

Install the security role first.
insert image description here
For example, disable anonymous authentication. After basic authentication is enabled, an account and password are required to access the website.
insert image description here

insert image description here

You can also restrict specific IP access, etc.
For example, my machine can be accessed normally,
insert image description here
but when the virtual network card gateway is disabled, it cannot be accessed.
insert image description here
insert image description here

Six, little knowledge

After we build a website, we can access it through the domain name and ip address,
but there are some differences between the two methods.
The domain name resolution directory will be under the specified directory of the website, and the IP address resolution directory will be in the upper-level directory of the website directory, and the scope will be wider.
For example :
I create a test111.txt file in the source code directory, the content is 1111111
insert image description here

Create test222.txt in the parent directory, the content is 2222222
insert image description here

Now use the domain name and ip to access respectively.
The domain name can be used to access test111.txt, but the test222.txt cannot be accessed
insert image description hereinsert image description here
and the ip access is the same. It is expected that test222.txt can be accessed, but test111.txt cannot be accessed. Overturned. After
thinking about it, my IP and domain name are bound here, and it is not built in the default website directory of IIS, and the local file corresponding to the IP address is the source file of the website, so it is the same after parsing
insert image description here

In the course, Xiaodige’s website is in the root directory of the default website. The key is that the domain name is bound to the local specified directory, which is in the next level directory of the root directory of the website. Therefore, the ip access is under the website root directory www, and the domain name is in the website directory under www, so there will be such a situation.
Welcome to discuss.


Summarize

This section mainly talks about some website construction and some functions using middleware. There are still many functions used that have not been written, so let's explore by yourself.

Guess you like

Origin blog.csdn.net/qq_61872115/article/details/129661956