Fortunately airship Guanya and formulas Great God Post Bar + group [6139371] precision landing, worry-free return of blood

Fortunately airship Guanya and formulas Great God Post Bar + group [6139371] precision landing, worry-free return of blood

Q technical expert group 6,139,371 online manual one guidance throughout the day! Years of experience and knowledge to share! Win team teach you practical plans!

Overview: Web server concept is widely used, most often we say that a Web server is the web server, which is based on the Internet and the program resides on a certain computer. Web server can provide documentation or other services to Web clients (such as browsers), as long as it follows the HTTP protocol designed web applications can be Web client.

Web server and HTTP server can be said the same thing, of course, have to be broken down, then, is to build HTTP server server provides documentation on HTTP protocol browsing, more is to provide a static file. The Web server covers HTTP server (this can be their own Baidu Encyclopedia), Web server can not only store information, but also to run scripts and programs on the basis of information provided by the user through a Web browser.
Web server is approximately equal to the HTTP server + other services

Currently there are many well-known Web server, which is the most mainstream of Apache, Nginx, IIS
implementation details of the major Web servers are different, for the design and development of a situation. But their basic working principle is the same, which is the basis of this article to explain the content.

A, Web server works illustration

First, we do not consider the HTTP protocol request of various ways, let's follow ** (Web server works a general description of 01) this figure, the first Web service workflows over again, we assume the browser as a client
( 1) the user has made an operation can fill in the URL hit Enter, click on the link may be, can click on buttons, etc., then the browser acquires the event.
(2) to establish a connection to the browser service program TCP.
(3) the user's browser in accordance with HTTP protocol format ** events packed into a packet, its essence is to be transmitted in the buffer section has a byte stream format of HTTP protocol.
(4) confirmation of the end of the browser can be written, and the packet pushed into the Internet, the packets through the network will eventually be submitted to the peer service program.
(5) the server program to get the data packet, the same solution to the HTTP protocol packet format, and parsing the client intended.
(6) after that client intent, classification process, or provide some documents, or processing data.
(7) will be loaded into the buffer, or HTML file, or a picture and so on.
(8) The HTTP protocol format data (7) Packaging
(9) on the server side can be written confirmation and pushes the data packet to the Internet, the packet eventually passed through the network to the client.
(10) to get the packet browser, the HTTP protocol unpacked format, and then parse the data, assuming an HTML file.
(11) The browser will display the HTML file in the page
to work more than the basic principles for the Web server. In fact, not difficult to find, this is just a simple network traffic. We should be convinced that as a server, its fundamental work no more than three

Receiving data 2. Send data 3. Data processing
and the nature of the Web server is receiving data ⇒ HTTP parsing logic processing ⇒ ⇒ ⇒ HTTP packets of data sent
high-level server is nothing more than these three sections more detailed design.
Second, the Web server provides the static file works illustrate
the main features of the Web server is serving static files. Daily surf mostly web browsing, few will have time to submit a number of operational data. Therefore, we combine on a diagram to explain the focus of Web server works in the GET request.

Other processes basically unchanged, focus on that red and blue section.
(1) is generated when the user clicks on a link or browser add some resources (css, jpg ...).
(6) The unpacking routine, which is determined as a GET request, and a request for a resource on the server. First service program to confirm the existence of the path, and then determine whether the path of the file can get.
(7-1) if the requested path is incorrect, or the resource can not be accessed user, the error page is returned. Many servers only error page 404, more professional should be misclassified and return an error code corresponding page.
(7-2) If the path is valid and the file can be acquired, then the service program loading process will be different according to the type of the file, as recorded type (8) in the return type corresponding to the HTTP protocol, and the response headers added.

Assuming that click on a page link, for example, the browser first HTML file requests over again to the same process resource file path to the HTML file contained in the order request.


Third, the data submitted to the Web server of graphic works
just browsing the web and can not meet the needs of all people, should be the client and server data interaction.
Even unilateral any natural resource request is the main force of the network.
We should clearly know that the data submitted for the user to have any effect.
(1) Resource upload (2) login authentication (3) API interface calls (4) remote command and other
data submitted so that the user has been a qualitative leap in operability, which makes HTTP connections to obtain short way to enhance static documents to dynamic interaction on the level. This property also catalyzes a variety of programming languages, frameworks. For example PHP, JavaWeb.
If you look at the current mainstream of those large servers, you'll find something and then advanced again Niubi actually is the most basic things built. So we can also learn about the way the oldest dynamic CGI technology

Other processes basically unchanged, focus on that red and blue section.
(1) the user submits data, if a user clicks a button to submit the information is completed. POST is written in the format (3) will be, and submitted to the executable program fill end of the service.
(6) the server will bind with the parameters CGI, the replication process, passing parameters and receiving results duct
(7) that the subprocess CGI, reception parameter (6) coming from the parent process, and returns the result to complete the operation.
Finally, the parent process will result into the static template file, into the buffer

Fourth, the dynamic technology
we have to understand, Web-based server that is a short connection, and the acquired data reaches the browser of the moment must be static and unchanging. So-called dynamic actually refers to two cases

The server generates:
(1) the user data POST to submit to a program, the program runs as a parameter, the results based on the data and loads the static template pages, return to the static pages. But for users, the same page, do one operation after the data is not the same. Well, this is the dynamic pages. (CGI principle)
principle (2) PHP is a GET request user php suffix file server to execute the file extension php PHP code, will fill the position code, and then return. Of course, you can submit the data involved in computing back again.
The client generates:
(1) the user GET request a JavaScript file, the server without any operator returns the static files. JS browser receives the file, execute and update the page locally.
(2) User POST to submit data to the server, the server returns the static files based on data submitted by the instruction, execute and update your browser received.
----------------
Disclaimer: This article is CSDN blogger "Qingcheng Mountain monk" of the original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source and link this statement.
Original link: https: //blog.csdn.net/qq_36359022/article/details/81666221

Guess you like

Origin www.cnblogs.com/qun115991/p/11710128.html