web basics and HTTP

Table of contents

1. DNS and domain name

1.1 Domain name overview

1.2 What is domain name resolution?

1.3 Domain Name Summary

1.4 DNS resolution

         2. The concept of web pages

2.1 What is a web page

2.2 Structure of the website

3. Web

3.1 Web overview

3.2 Static pages and dynamic pages

4. HTTP protocol

4.1 Basic Concepts of HTTP Protocol

4.2 HTTP status code


1. DNS and domain name

1.1 Domain name overview

A domain name is actually an easy-to-remember set of addresses for a server (website, email, etc.). For example: URLs of websites we usually visit, http://findland.cn (first-level/top-level/naked domain name), http://www.findland.cn (second-level domain name).

Note: These two domain names are different domain names. The reason why we can access these two domain names is that when the domain name is resolved, these two corresponding records are added, and when the domain name is bound, it must correspond to the resolved domain name.

1.2 What is domain name resolution?

In the beginning, all addresses on the Internet were IP addresses, but because these IP addresses were too difficult to remember, domain names (such as http://www.findland.cn ) appeared . Domain name resolution is an act of converting a domain name into an IP address to access an input URL.

1.3 Domain Name Summary

1. Interaction on the network is based on the TCP/IP protocol. Each host logically has a unique location identifier (IP address), and the physical address is a MAC address. 2. In order to ensure the uniqueness of the address, the user agreement applies to a special organization for registration and assigns IP addresses.

1.4 DNS resolution

There are three DNS resolution methods: ① /etc/hosts is the file responsible for fast resolution in the linux system, including the mapping relationship between ip and host name. In the absence of a DNS server, use the local /etc/hosts to complete the resolution/mapping to achieve fast access. PS: Mainly used for the mapping/resolution relationship between hosts (IP and host name), for example: 192.168. 2.168.226.130 node2

② /etc/resolv.conf DNS client configuration file, which is mainly used to set the IP and domain name of the DNS server, and also includes the search order of the host domain name, etc. This file is used by the domain name resolver (resolver, a library that resolves IP addresses based on host names). PS: Mainly used to match DNS servers, for example: nameserver 114.114.114.114 nameserver 8.8.8.8 nameserver 218.2.135.1

③ /etc/sysconfig/network-scripts/ifcfg-ens33 We can also define DNS1= DNS2= in the network card configuration file

Effective sequence 1 hosts file 2 NIC configuration file 3 /etc/resolv.conf

2. The concept of web pages

2.1 What is a web page

A web page, also known as a web page, is the basic element that constitutes a website. It is an information expression method formed by connecting multimedia information such as text, graphics, sound, and animation. The page opened by people entering the URL in the browser is generally called the home page of the website, from which they can learn about the information and content of the URL, and it is the "entrance" for users to browse the site, and is the starting point and summary point of the entire Web site. A web page generally consists of a site logo, navigation bar, advertisement bar, information area, and copyright area.

A website is a collection of related web pages in the form of hyperlinks on the Internet. It is a complete whole composed of one or more web pages. People can visit the website through a browser to obtain the resources they need and enjoy the services provided by the network . Websites can be divided into portal websites, personal websites, and functional websites according to their content.

2.2 Structure of the website

<!DOCTYPE html>
<html lang="en"> //en stands for English <head> // Three functions
of the head of the webpage    
                            : ※ Set the title of the webpage;
 ※ Set the encoding format of the webpage; ※
 Tell the search engine, the search keyword of the webpage (optional)
     <meta charset="UTF-8"> //Determine the encoding format of the webpage <meta
    content="Front-end engineer, product manager" name="keywords">
     <title>My first webpage file</title> //Title of the webpage
</head>
<body> //The main part of the webpage
   //The content is stored in the theme of the webpage, F12 can be used for webpage debugging
</body>
</html>

Common tags in header tags

Tag Description
<title> defines the title of the document
<base> defines the default link address of the page link tag
<link> defines the relationship between a document and external resources
<meta> defines the metadata in the HTML document
<script> defines the client script file
<style> defines the style file of the HTML document

Commonly used tags in the content tag

Tag Description
<table> defines a table
<tr> defines a row in a table
<td> defines a column in a table row
<img> defines an image
<a> defines a hyperlink
<p> defines a row
<br> defines a line break
<font> defines a font

3.Web

3.1 Web overview

        The web (World Wide Web) is the global wide area network, also known as the World Wide Web, which is a global, dynamic interactive, cross-platform distributed graphic information system based on hypertext and HTTP. It is a network service built on the Internet. It provides a graphical, easy-to-access and intuitive interface for viewers to search and browse information on the Internet. The documents and hyperlinks in it organize the information nodes on the Internet into an interrelated network structure.

3.2 Static pages and dynamic pages

(1) Static page definition ① Static web pages are standard HTML files ② Extensions are .htm, .html, such as text, images, sounds, Flash animations, client-side scripts, ActiveX controls, and Java applets, etc. ③ It is the foundation of website construction. Early websites are generally made of static web pages ④ There is no background database, no program, and non-interactive web pages

(2) Static page features: ① Each static web page has a fixed URL, and the URL is suffixed with common forms such as .htm, .html, .shtml, etc. without "?" The interactivity of static web pages is poor, and there are great limitations in terms of functions ⑥ The page browsing speed is fast, the process does not need to connect to the database, and the page opening speed is faster than that of dynamic pages

(3) Dynamic pages ① The URL of the web page is not fixed, and can interact with users through the background ② There is an iconic symbol in the URL of the dynamic web page—“?” ③ Commonly used languages ​​​​are PHP, JSP, Python, Ruby, etc.

(4) Features of dynamic pages ① Interactive webpages will dynamically change and respond according to user requirements and choices, and browsers will be used as client interfaces, which will be the general trend of WEB development in the future. ② Automatic update will automatically generate new pages without manually updating HTML documents, which can greatly save workload.

4. HTTP protocol

4.1 Basic Concepts of HTTP Protocol

HTTP, the full name is HyperText Transfer Protocol, which is the Hypertext Transfer Protocol. It is the most widely used network protocol on the Internet, and all www files must comply with this standard.

HTTP features:

  • HTTP is connectionless and stateless
  • HTTP is generally built on top of the TCP/IP protocol, and the default port number is 80

HTTP can be broken down into two parts, the request and the response.

HTTP request:

HTTP defines different ways to interact with the server, and there are four most commonly used methods, namely GET, POST, PUT, and DELETE. The full name of URL is a resource descriptor, which can be considered as follows: a URL address corresponds to a resource on the network, and GET, POST, PUT, and DELETE in HTTP correspond to four operations of querying, modifying, adding, and deleting this resource.

An HTTP request consists of three parts, namely: status line, request header (Request Header), and request body.

4.2 HTTP status code

When using a browser to access a certain URL, the corresponding processing status will be returned according to the processing status

Usually the normal status code is 2xx, 3xx (such as 200)

If an exception occurs, it will return 4xx, 5xx (such as 404)

The first digit of the status code Defined range Category

1xx 100-101 Information prompt

2xx 200-206 Success

3xx 300-305 redirection

4xx 400-415 client error

5xx 500-505 server error

Common HTTP status codes in the production environment

information describe
200 OK The request was successful (followed by the response document to GET and POST requests)
301 Moved Permanently Requested permanent page jump
403   Forbidden Do not access this page
404 Not Found The server cannot find the requested page
500 Internal Server Error internal server error
502 Bad Gateway invalid gateway
503 Service Unavailable current service unavailable
504 Gateway Timeout Gateway request timed out

Guess you like

Origin blog.csdn.net/weixin_44473708/article/details/131227147