01.WEB Service and HTTP protocol 01.01.Web service basics: DNS
Web services are inseparable from the underlying network and DNS services.
User access to the basic process of the site, that is, the DNS resolution process
1). browser input URL www.baidu.com, find the local DNS cache and Hosts file information, if there is a direct access to the IP address;
2). If not, send the resolution request to the DNS server address, if the Ldns server cache has a corresponding address, then obtain the IP address;
3). If not, Ldns continues to request the DNS root (.) Server, layer by layer to find the authoritative DNS server that corresponds to the baidu.com domain name, and the server returns IP parsing records to Ldns;
4). Ldns sends IP parsing records to the client browser and caches them.
5). The client browser requests the Web server, the Web server processes the request and responds, the client receives the requested content, and ends the access.
Related commands:
Ipconfig/displaydns
Ipconfig/flushdns #清楚本地DNS缓存
C:\Windows\System32\drivers\etc\hosts #hosts文件位置
Dig-trace www.baidu.com
01.02.HTTP protocol
The HTTP protocol (hypertext Transfer protocal), Hypertext Transfer Protocol, provides a way to publish and accept HTML pages.
The concept of HTTP service, WWW service, Web service is confusing, referring to the default HTTP (80) and encrypted HTTPS (443) services.
HTTP protocol version
1). http/1.0, the browser and the server only to maintain a short-term connection, the browser each request to establish a TCP connection with the server, the server completes the request processing is to disconnect the TCP connection, the server does not track each user, nor log past requests.
2). http/1.1, which supports persistent connections, a TCP connection can transmit multiple HTTP requests and responses, reducing the consumption and time delay of establishing and shutting down the connection. Additional request headers and response header information are added to enhance HTTP functionality (for example, the browser uses the hostname header to explicitly access the server's virtual Web site). http/1.1 also provides related request headers and responses to mechanisms such as identity authentication, state management, and cache caching.
HTTP request method: GET, POST, HEAD, PUT, DELETE, MOVE.
HTTP common status code: 200-OK, 301-Permanent jump, 403-Forbidden, 404-not Found, 500-Internal server error, 502-bad Gateway, 503-Server is currently unavailable, 504-gateway timed out.
Curl-i www.baidu.com #查看状态码
HTTP request message
Message format |
Message information |
Request Line |
Request Method URL Protocol version |
Request Header |
|
Blank Line |
Blank no content |
Request message body |
The Get method does not request a message body, and the Post method has |
HTTP response Messages
Message format |
Message information |
Response Head |
|
Blank Line |
|
Response message body |
|
|
|
HTTP protocol Flow
1). A Web browser establishes a TCP connection between the parsed IP address and the port number and the Web server;
2). After a TCP connection is established, the Web browser sends an HTTP request message to the Web server;
3). The Web server responds and reads the browser's request information and returns an HTTP response message;
4) The Web server closes the HTTP connection, closes the TCP connection, and the Web browser displays the content of the Web site visited.
Url,uniform Resource location, Uniform Resource Locator, is the URL. Protocol://Domain/resource http://www.baidu.com/1.jpg
01.03. Website Traffic Metrics terminology
IP (stand-alone IP), Internet Protocol, refers to the total number of times a computer with different IP addresses is remembered when accessing a website.
PV (traffic), Page view, PageView, as long as the access page will be calculated PV, one time to remember a PV.
UV (independent traffic), unique Visitor, the number of times a client visits a website is credited as a visitor. Use technologies such as cookies as a statistical basis.
01.04.HTTP Service Software
Common static Web Services software: apache,nginx,lighttpd.
Software used to provide dynamic services: PHP (FastCGI), Tomcat (Jsp,do), Resin (Jsp,do), IIS (asp,aspx).
Web cluster notes (1)-web Service and HTTP protocol