MIME
:
MIME (Multipurpose Internet Mail Extensions) multi-purpose Internet Mail extension type. Is the type of file that sets the extension of an application to be opened by an app, and when the extension file is accessed, the browser automatically opens with the specified application. Many are used to specify some client-customized file names, as well as some ways to open media files.
It is an Internet standard that expands the e-mail standard to enable it to support:
Non-ASCII (American Standard Information Interchange Code)) Word literals, non-text format attachment (binary, sound, image, etc.); a message body composed of multipart (multiple parts); header information containing non-ASCII characters (header information)
This standard is defined in RFC 2045 (a series of numbered files), RFC 2046, RFC 2047, RFC 2048, RFC 2049, and so on. MIME improved RFC 2822, which was changed by RFC 822, which specifies that e-mail standards do not allow the use of characters other than the 7-bit ASCII character set in mail messages. Because of this, some non-English character messages and binary files, images, sounds and other non-text messages can not be transmitted in the E-mail (MIME). MIME defines a symbolic method for representing a wide variety of data types. In addition, a MIME framework is used in the HTTP protocol used in the World Wide Web, and the standard is extended to the Internet media type.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image002 "border=" 0 "alt=" clip_image002 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiom1fc0e6tpkdraada9rizle8923.jpg "" 504 "height=" 424 "/>
Detailed Analysis: http://baike.baidu.com/link?url=pQ60_ Slmcfruazdxif-chntsf7yhh03qp2sbsqq6l7cqve8mqy3g1zj57pccuzfdlvgiyqgdknkhr2vwmu5rhk
HTTP
method of Request:
HTTP requests can use a variety of request methods, depending on the HTTP standard.
HTTP1.0 defines three methods of request: GET, POST, and head.
HTTP1.1 has five new request methods: Options, PUT, DELETE, TRACE, and CONNECT methods.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image004 "border=" 0 "alt=" clip_image004 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiol1fc0e_hs63vaacug6e5jjo743.jpg "604" height= "/>"
Attention:
1) The method name is case-sensitive, and the server should return a status code of 405 (Mothod not allowed) when a request is directed to a resource that does not support the corresponding request method, and the status Code 501 (not) should be returned when the server does not recognize or support the corresponding request method. Implemented).
2) HTTP server should at least implement the Get and Head/post methods, other methods are optional, in addition to the above method, the specific HTTP server supports the extension of the custom method
Explanation: Http://tools.jb51.net/table/http_request_method
HTTP Message Fabric Client Request message
The client sends a HTTP Request -to-server request messages include the following format: Request lines ( Request Line ), request header ( Header ), a blank line, and four parts of the request data, the general format of the request message is given.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image005 "border=" 0 "alt=" clip_image005 "src=" http://s3.51cto.com/wyfs02/M02/86/87/ Wkiol1fc0fdxeqwpaabocw3k7y0945.png "" 504 "height=" 181 "/>
Server Response Message
The HTTP response is also made up of four parts: the status line, the message header, the blank line, and the response body.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image007 "border=" 0 "alt=" clip_image007 "src=" http://s3.51cto.com/wyfs02/M02/86/87/ Wkiom1fc0fgde1vvaabgdfl_xyu889.jpg "" 504 "height=" 227 "/>
Instance
The following example is a typical example of using get to pass data:
Client Request:
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image009 "border=" 0 "alt=" clip_image009 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiom1fc0fhjuagbaaa0fo8awi8050.jpg "" 604 "height="/>
Service-Side response:
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image011 "border=" 0 "alt=" clip_image011 "src=" http://s3.51cto.com/wyfs02/M02/86/87/ Wkiom1fc0fld6h3jaabpt7recbe010.jpg "" 604 "height=" 171 "/>
Output Result:
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image013 "border=" 0 "alt=" clip_image013 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiol1fc0fkjho6haaazjami2vm793.jpg "" 604 "height=" "/>
HTTP Introduction
The HTTP protocol is an abbreviation for the Hyper Text Transfer Protocol (Hypertext Transfer Protocol), which is used to transfer hypertext to the local browser from the World Wide Web (www:world Wide Web) server.
HTTP is a TCP/IP communication protocol that transmits data (HTML files, image files, query results, and so on).
HTTP Working principle
The HTTP protocol works on the client-server architecture. The browser sends all requests via URLs to the HTTP server, which is the Web servers, as an HTTP client.
The Web server has: Apache server, IIS server (Internet information Services) and so on.
The Web server sends a response message to the client, based on the received request.
The HTTP default port number is 80, but you can also change to 8080 or another port.
HTTP three things to note:
· HTTP is no connection: the meaning of no connection is to limit the processing of only one request per connection. When the server finishes processing the customer's request and receives the customer's answer, the connection is disconnected. In this way, the transmission time can be saved.
· HTTP is media Independent: This means that any type of data can be sent over HTTP as long as the client and the server know what to do with the data content. The client and server specify that the appropriate Mime-type content type be used.
· HTTP is stateless: The HTTP protocol is a stateless protocol. Stateless means that the protocol has no memory capacity for transactional processing. A lack of state means that if the previous information is required for subsequent processing, it must be re-routed, which may cause the amount of data to be transferred per connection to increase. On the other hand, it responds faster when the server does not need the previous information.
The HTTP protocol communication flow is shown in the table:
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image015 "border=" 0 "alt=" clip_image015 "src=" http://s3.51cto.com/wyfs02/M00/86/87/ Wkiol1fc0fpdpvoeaabaesf2src828.jpg "" 504 "height=" 290 "/>
HTTP Return Status code
When a viewer accesses a webpage, the browser of the viewer makes a request to the server where the page is located. When a Web page is received and displayed by the browser, the server on which the page resides returns a message header (server header) that contains the HTTP status code to respond to the browser's request.
HTTP status code in English is HTTP status code.
The following are the common HTTP status codes:
· 200-Successful request
· 301-Resources (Web pages, etc.) are permanently transferred to other URLs
· 404-The requested resource (Web page, etc.) does not exist
· 500-Internal Server error
HTTP status Code classification
The HTTP status code consists of three decimal digits, the first decimal number defines the type of the status code, and the latter two numbers do not have a function of classification. There are 5 types of HTTP status codes:
HTTP status Code classification
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image017 "border=" 0 "alt=" clip_image017 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiom1fc0ftrdzyuaablk_s2bbe771.jpg "" 504 "height=" 169 "/>
Explanation: Http://tools.jb51.net/table/http_status_code
SSL
with HTTPS
(Ssl+http
)
About SSL
1) Introduction
SSL (Secure Socket Layer) has been developed by Netscape to secure data transmission over the Internet, and the use of encryption (encryption) technology ensures that data is not intercepted and tapped during transmission over the network. It has been widely used for authentication and encrypted data transfer between Web browsers and servers. The SSL protocol is located between the TCP/IP protocol and various application layer protocols, providing security support for data communication.
2) services provided by SSL
A. Authenticating users and servers to ensure that data is sent to the correct client and server
B. Encrypt data to prevent the data from being stolen in the middle
C. Maintain the integrity of the data to ensure that the data is not changed during transmission.
3) Handshake process for SSL protocol
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image019 "border=" 0 "alt=" clip_image019 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiom1fc0fxckv7raacjvm6z4pi883.jpg "" 504 "height=" 361 "/>
HTTPS Concepts
1) Introduction
HTTPS (full name: Hypertext Transfer Protocol over secure Socket Layer) is a security-targeted HTTP channel and is simply a secure version of HTTP. That is, the SSL layer is added under HTTP, the security base of HTTPS is SSL, so the detailed content of encryption needs SSL. The initial development of the system, conducted by Netscape, provides an authentication and encryption method of communication, which is now widely used in security-sensitive communications on the World Wide Web, such as transaction payments.
2) The difference between HTTPS and HTTP
A. The HTTPS protocol requires a certificate to be applied to the CA, and the general free certificate is very small and requires a fee.
B. HTTP is a Hypertext Transfer Protocol, the information is transmitted in plaintext, and HTTPS is an SSL encrypted transport protocol with security.
C. http and HTTPS use a completely different way of connecting, with the same port, the former is 80, the latter is 443.
D. HTTP connection is simple and stateless; The HTTPS protocol is a network protocol built by the SSL+HTTP protocol for encrypted transmission and authentication, which is more secure than the HTTP protocol.
3) The role of HTTPS
Its main role can be divided into two kinds: one is to establish an information security channel to ensure the security of data transmission, the other is to confirm the authenticity of the website.
A HTTPS in the general sense is that the server has a certificate. The main purpose is to ensure that the server is the server he claims, this is the same as the 1th; all communication between the service and the client is encrypted.
B. Specifically, it is the client that generates a symmetric key, exchanging the key through the server's certificate, the handshake process in the general sense.
C. All the information that follows is encrypted. Even if a third party intercepts, it doesn't make any sense, because he doesn't have a key, and of course it doesn't make sense to tamper with it.
D In the case of a small client requirement, the client must also have a certificate.
Here the client certificate, in fact, similar to the personal information, in addition to the user name/password, there is a CA authenticated identity. Because personal certificates are generally not emulated by others, all this can be a deeper confirmation of their identity. Currently a small number of personal banking Professional Edition is this practice, the specific certificate may be to take a U-Shield as a backup carrier.
The principle of HTTP implementation:
1) Symmetric encryption: The key is only one, encryption and decryption for the same password, and the decryption speed is fast, the typical symmetric encryption algorithm has DES, AES and so on;
2) Asymmetric encryption: The key in pairs appear (and according to the public key can not infer the private key, according to the private key can not infer the public key), encryption and decryption using different keys (public key encryption requires private key decryption, private key encryption requires public key decryption), relatively symmetric encryption speed is slow, the typical asymmetric encryption algorithm has RSA, DSA, etc.
Communication process for HTTPS
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image021 "border=" 0 "alt=" clip_image021 "src=" http://s3.51cto.com/wyfs02/M01/86/87/ Wkiol1fc0fbbpkokaaef1kny2eo403.png "" "height=" 366 "/>
Explanation: http://blog.163.com/magicc_love/blog/static/185853662201321423527263/
http://blog.csdn.net/zmx729618/article/details/51372659
WEB
operating mode of the server:
1. C/S (client/server) mode:
1.1 Two-tier structure C/s mode
The transaction logic unit is implemented on the client side, the customer is a "fat customer" and the server is a "thin server".
Any one C/S application system consists of the display logical part (presentation layer), the transaction logic part (the function layer) and the Data Processing logic part (datum layer). The function of the presentation layer is to realize the interaction with the user, the function layer is to carry on the concrete computation and the data processing, the function of the data layer is to realize the task of querying, modifying and updating the data in the database.
In the two-tier structure of C/s mode, the display logic and transaction logic parts are placed on the client, the data processing logic and the database on the server side, so that the client becomes very "fat", become a FAT client, relative to the server side of the task lighter, become thin server. The two-tier C/s structure is shown in 1-1.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image023 "border=" 0 "alt=" clip_image023 "src=" http://s3.51cto.com/wyfs02/M02/86/88/ Wkiom1fc0ffqtzk4aabu7oqyfnc483.jpg "" 504 "height="/>
This traditional two-tier architecture is more suitable for small-scale, user-less, single-database and secure. This traditional two-tier architecture is more suitable for small-scale, user-less, single-database and security-and fast-secure LAN environment operation.
1.2 Three-layer structure C/s mode
The three-layer C/s structure explicitly divides the presentation layer, the function layer and the data layer, and makes it logically independent. The display logic is placed on the client, the transaction logic is placed in the function layer as the transaction Server, the data processing logic and the database are placed on the server side, because the transaction logic unit is implemented in the specialized transaction processing server, so the client's task is greatly reduced and become "thin customer". The three-layer C/s structure is shown in 1-2.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image025 "border=" 0 "alt=" clip_image025 "src=" http://s3.51cto.com/wyfs02/M00/86/88/ Wkiom1fc0ffqh1vhaabt2vczq2g518.jpg "" 504 "height=" 276 "/>
2.b/s mode
b/S (browser/server) mode is a new network management information system platform model based on web technology. b/S is a three-tier architecture in which the presentation layer, function layer, and data layer are divided into three relatively separate units: Web browsers, Web servers with application extensions, and database servers.
Three-layer B/S architecture is the two-layer C/s structure of the transaction processing logic module from the client's task, separated by a separate layer to bear its task, the load is distributed evenly to the Web server, so the client's pressure greatly reduced, this B/S three layer architecture 1-3 is shown.
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image027 "border=" 0 "alt=" clip_image027 "src=" http://s3.51cto.com/wyfs02/M01/86/88/ Wkiom1fc0fig1btmaabwphls9is204.jpg "" 504 "height=" 277 "/>
Web
dynamic and static separation of servers
Static and dynamic separation is to place the Web site at Rest Resources (HTML,CSS,JS,IMG). Deploy separately from the background app to increase user access to static code and reduce access to background apps.
How static resources are deployed:
We need a public place to store our Html–web servers (Web containers, Web sites). Good, so I found it. nginx node tomcat
阿帕奇
winsever
All can be used as servers. Finally, the choice of nginx (to pure clean point), the previous node, However, node is a server-side in a certain sense. Our goal is to achieve static and dynamic separation, if the business needs, you can use the node server to write some back-end business logic code. Nginx as a static server is the best choice. That is, our application server. There's no extra introduction to nginx here.
Front-end Development (Single page application Angular React Vue):
Single page application, is the whole station on a index.html.url route, the front-end state management has given the jser to operate.
Back-end Development (Restful+json):
The backend app provides APIs that are processed according to the front-end requests and return the processing results to the front end in JSON format.
Cross-domain processing:
Dynamic separation because static resources and application services are deployed on separate servers, you face the choice of a domain name policy. Same domain name and different domain name.
Explanation: Http://www.tuicool.com/articles/vUbIRfM
CGI
A Basic principle
CGI: Universal Gateway Interface (Common Gateway Interface) is a WEB server host that provides information services
Standard interface for the service. Through the CGI interface, the WEB server can obtain the information submitted by the client, transfer it to the server-side CGI program, and finally return the result to the client.
The CGI communication system consists of two parts: the HTML page, which is the page that is displayed on the user-side browser. The other part is a CGI program running on the server.
The means of communication between them are as follows:
650) this.width=650; "Style=" background-image:none; border-bottom:0px; border-left:0px; padding-left:0px; padding-right:0px; border-top:0px; border-right:0px; padding-top:0px "title=" clip_image029 "border=" 0 "alt=" clip_image029 "src=" http://s3.51cto.com/wyfs02/M02/86/88/ Wkiom1fc0fmai4vtaaa668k5uug171.jpg "" 504 "height="/>
Explanation: Http://wenku.baidu.com/link?url=i-bW1yCFMWeG-x_pNNzYPTsmwpb8O2TK-MEimW1uagquljXwBG8bOcV2DkmBNo2NmEip5ZbzYs_ Zru8m4iqx2xbdmftftx7k0n2_7rrokwg
Apache Features and website basics