DNS WEB HTTP

DNS and domain names

The network communicates and connects based on the TCP/IP protocol.

Each host has a unique identifier, which is used to distinguish thousands of users and computers on the network . That is, a fixed IP address (32-bit binary number converted into a decimal number - dotted decimal). Every computer and server connected to the Internet is assigned a unique address.

There are two sets of address schemes in assigning  IP  addresses in the network: IP address system and domain name address system. The two sets of address systems are corresponding. Since the IP address is a digital identifier, a symbolic address scheme has been developed on the basis of the IP address to replace the digital IP address.

DNS resolution method

  •  /etc/hosts 

The file responsible for fast parsing in the Linux system includes the mapping relationship between ip and host name. (An IP address corresponds to a host name). If there is no DNS server, use the local /etc/hosts to complete the parsing and mapping to achieve fast access .

  • /etc/resolv.conf

The DNS client configuration file 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. It
is mainly a configuration file used by the domain name resolution server.

  • /etc/sysconfig/network-scripts/ifcfg-ens33

Configure the network card file, and define the values ​​of DNS1 and DNS2 in the network card configuration file.

Effective order: hosts file NIC configuration file /etc/resolv.conf

domain name

A tree structure that identifies a group of hosts and provides information about them (mainly determine where the root is, and each branch can be determined)

Domain name server
① A program that maintains and maintains the domain name space
② Responds to resolver requests

The resolver (client)
is a device that sends a request to the DNS server, and the process is as follows:

Root Domain - Top Level Domain - Second Level Domain - Subdomain - Hostname

domain registration

The registration process is as follows:

Prepare application materials - find domain name registration website - query domain name - formal application - apply for successful use

HTML

HTML concept

HTML hypertext markup language is a standardized and standard language format, and the web page file itself is a text file. HTML tells the browser how to display the content of the text through markup. HTML is a text file, all tools that can generate txt files can be edited, the file extension after modification: .html or .htm

Web page

  • Web page

Files in plain text format, written in HTML, are "translated" into web pages in the user's browser and displayed

  • website

Consisting of one page at a time, it is a combination of multiple web pages

  • home page

The first page that appears after opening a website is called the home page (or home page) of the website

  • domain name

URLs entered while browsing the web

  • HTTP/HTTPS

The communication protocol (encrypted or not) used to transmit web pages is a communication/interaction standard/specification

  • URL

is a World Wide Web addressing system (unique identification)

  • HTML 

hypertext markup language for writing web pages

  • Hyperlink

A hyperlink is a function of linking different pages in a website

  • release

The process of uploading the prepared webpage to the server for user access

Web

Web (World Wide Web) is the global wide area network, also known as the World Wide Web, a distributed graphic information system, and a network service established on the Internet.

Web1.0

Characterized by editing, the content provided by the website to the user is edited and processed, and then the user reads the content provided by the website.
This process is a one-way behavior from the website to the user.

Web2.0

Pay more attention to user interaction, users are not only consumers (browsers) of website content, but also producers of website content, which
strengthens the interaction between website and users.

Static pages

Static web pages are standard HTML files
with extensions of .htm and .html.
For example: text, images, sounds, Flash animations, client-side scripts, ActiveX controls, and Java applets
are the basis of website construction. Early websites generally consisted of static web pages. It is relatively cumbersome to make
web pages that do not have a background database, do not contain programs, and cannot be interacted with
, and are suitable for display websites that are generally less updated

Static page features

Each static webpage has a fixed URL, suffixed with common forms such as .htm.htm, without "?"
Each static webpage is stored on the website server.
The content of the static webpage is relatively stable and easy to be searched Search engines
Static web pages do not have the support of a database, so the workload in production and maintenance is relatively large, and it is difficult to simply use static
web pages. The page browsing speed is fast, and the process does not need to connect to the database
. No interactivity, only viewing functions are limited

dynamic page 

  • The URL of the webpage is not fixed, and users can interact with background data
  • In dynamic page URLs, special tags are included
  • Commonly used languages ​​are PHP, JSP, Python, Ruby, etc.

Dynamic page features 

  • interact
  • automatic update
  • special effects

HTTP protocol

HTTP Hypertext Transfer Protocol (HyperText Transfer Protocol) is the most widely used network protocol on the Internet. It is an application layer transfer protocol based on the TCP protocol and a rule for data transmission between clients and servers.

 HTTP is a stateless protocol.
The HTTP protocol itself does not persist the sent requests and corresponding communication states.
The purpose of this is to keep the simplicity of the HTTP protocol, so that a large number of transactions can be processed quickly and efficiency is improved.

work process

  1. The client and server make a tcp connection.
    Three-way handshake - establish a connection
  2. The client sends an http request, and the server responds to the client's request after receiving the http request
  3. Socket interface, communicate through the port
  4. The response reaches the client, the process of parsing (browser), and the user views, uses, and accesses.
  5. Access, use, view, when finished, disconnect
    four waves - disconnect

Cookie

Record the user's login status, track and count the user's habit of visiting the website, identify the user's identity, and save user data. This is a small file that the server places on the user's computer.

HTTP 1.1

Built-in link maintenance function, long connection

https: Encrypted communication protocol, encrypted data transmission. The encryption process involves key exchange between the client and the server to ensure that only the legal recipient can decrypt the data.
Certificate: https uses digital certificates to verify identity
https: e-commerce, bank websites; encryption and decryption will have a certain impact on access speed.

Long connection

Get all the letter information of the page file at one time, no need to process the request separately, so the speed is greatly accelerated.

connection hold

Keep - Alive can transmit multiple HTTP requests and responses. The delay consumed by establishing and closing is reduced, and the effective duration of connection maintenance is 60 seconds by default.

Connection resource usage

Long-term storage will reduce the server load; if the concurrency is increased, the server will run out of resources

Connection State Management

Long connections need to maintain the connection state, and the server has to track each connection state, which increases the burden (hence the cluster)

HTTP request method

The Request Headers contain the request body:

Accept: The data type acceptable to the client
Accept-Language: The language type acceptable to the client
User-Agent: Browser information
Accept-Encoding: The encoding format acceptable to the client
Host: Indicates the requested ip and port number
Connection: Tell the server how to handle the request connection
Cache-Control: Cache time cache time of pictures or audio files
Keep-Alive: Inform the server to return data not to close immediately, keep a short connection
Closed: Close immediately

 get request method

  • Get data from specified server
  • get requests can be cached
  • The get request will be saved in the browser record Cookie
  • Get request length is limited

post request method

  • post requests cannot be cached
  • post requests are not logged in browser logs
  • Request body length is unlimited

Status Code - The server provided the *face

After the request, the server will receive the request, and will feed back a code when there is a response. Next, we will introduce the response code types:

100 - 101 message notification
200 - 206 successful request response
300 - 305 Redirection means
100 - 101 message notification
200 - 206 successful request response
300 - 305 Redirection means

common code

200 Represents success "OK"
301 Requested permanent page jump
304 request to cache
403

No Access

404 The requested page could not be found
500 Internal server error (misconfiguration)
503 service is not available
504 Gateway request timed out

Communication socket Socket

Realize communication and data exchange between different hosts, inter-process transmission standard: IP port

The role of Socket in the HTTP protocol:

  • The client socket address defines a unique client process
  • The server socket address defines a unique server process

Socket related system calls:

  • socket() creates a socket
  • bind() Bind IP and port
  • listen() monitor
  • accept() receives the request
  • connect() request connection establishment
  • write() sends
  • read() receives
  • close() closes the connection
  • ESTABLISHED: The connection has been established and data is being transferred

Guess you like

Origin blog.csdn.net/ZWH9991/article/details/132272745