Explanation of HTTP Access Service

Source: Internet
Author: User
Tags website server purchase domain name

First, access to the basic process of the site

The first step: client users in the browser input Www.51cto.com website, enter, the system will first find the system local DNS cache and Hosts file information, determine if there is a www.51cto.com name corresponding IP resolution record, if there is a direct acquisition of IP address, and then go to the IP address corresponding to the name of the www.51cto.com Server. Generally, the first request, the DNS cache is not resolved records, and the hosts hide in the internal temporary test use.

Second step: If the client local DNS cache and the Hosts file does not have the www.51cto.com the corresponding resolution record, then, the system will send the browser's resolution request to the client local Settings DNS server address (called Ldns) resolution, if the local cache of the LDNS server has a corresponding resolution record will be returned directly Return the IP address to the client, and if not, LDNS will be responsible for continuing to request additional DNS servers.

The third step: Ldns from the root of the DNS system to request the resolution of the www.51cto.com, and for each level of DNS server system for a series of lookups, will eventually find the 51cto.com domain name corresponding to the authorized DNS server, and this authorized DNS server official enterprise purchase domain name used to manage the domain name solution Server, this authorization server will have www.51cto.com corresponding IP resolution records. If not at this time, it means that the domain manager of the enterprise does not have the www.51cto.com domain name to do the analytic setting, namely the website has not set up well.

Fourth step: 51cto.com the authoritative DNS server will send www.51cto.com the corresponding final IP resolution records to LDNS.

Fifth step: Ldns from the Authorized DNS server www.51cto.com corresponding IP resolution record to the client browser, and it will be the domain name and IP address corresponding resolution cache, so that the next faster return of the same resolution request records, these cache records at the specified time (DNS TTL) does not expire within.

The sixth step: the client browser obtains the www.51cto.com corresponding IP address, next, the browser will request to obtain the IP address corresponding website server, the website server receives the customer request and responds to the processing (here the processing may be hundreds of clustered server system, may also be a cloud host), returns the customer request content to the guest User-side browser. At this point, the complete process of visiting the Web page is complete.

Report:

(1) To view local cache records for Windows clients:

Ifconfig/displaydns

(2) Clear Windows client local cache DNS records:

Ifconfig/flushdns

(3) The hosts domain name resolution record location under Windows system:

C:\Windows\System32\drivers\etc\hosts

II. basic process of DNS system parsing

Introduction to DNS

A record----resolves the remainder name to the corresponding IP address.

CNAME alias Record--alias parsing function standby CDN Accelerator Service Application

MX Mail record--mx recording function, which will be used when purchasing or building mail server

PTR record-reverse resolution, that is, the IP address resolution to the corresponding domain name, and a record of the resolution, this function in the mail service business will be used

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/88/56/wKiom1fvvOzj2WqVAACIHoN53c0064.jpg-wh_500x0-wm_3 -wmp_4-s_1324839642.jpg "title=" 123.jpg "alt=" Wkiom1fvvozj2wqvaacihon53c0064.jpg-wh_50 "/>

DNS parsing flowchart

650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/88/56/wKiom1fvv2niTTGgAAFPQz6r41k630.jpg-wh_500x0-wm_3 -wmp_4-s_2563572070.jpg "title=" 123.jpg "alt=" Wkiom1fvv2nittggaafpqz6r41k630.jpg-wh_50 "/>


Practice Understanding DNS resolution process with dig command

[[email protected] ~]# dig +trace www.51cto.com; <<>> dig  9.8.2rc1-redhat-9.8.2-0.17.rc1.el6_4.6 <<>> +trace www.51cto.com;;  global options: +cmd.             47942    in    ns    j.root-servers.net.             47942    IN     ns    f.root-servers.net.             47942    IN     ns    b.root-servers.net.             47942    IN     ns    h.root-servers.net.            &nBsp;47942    in    ns    e.root-servers.net.             47942    IN     ns    g.root-servers.net.             47942    IN     ns    k.root-servers.net.             47942    IN     ns    l.root-servers.net.             47942    IN     ns    m.root-servers.net.             47942    IN     ns    i.root-servers.net.             47942    IN    NS     c.root-servers.net.             47942    IN     ns    a.root-servers.net.             47942    IN     NS    d.root-servers.net.;;  received 228 bytes from 192.168.0.1#53 (192.168.0.1)  in 54 ms##  A-m a total of 13 DNS servers, j.root-servers.net root DNS is responsible for the resolution here com.             172800    IN    NS     a.gtld-servers.net.com.            172800     in    ns    b.gtld-servers.net.coM.            172800    in     NS    c.gtld-servers.net.com.             172800    IN    NS     d.gtld-servers.net.com.             172800    in    ns    e.gtld-servers.net.com.             172800    IN     NS    f.gtld-servers.net.com.             172800    IN    NS     g.gtld-servers.net.com.            172800     in    ns    h.gtld-servers.net.com.             172800    IN    NS     i.gtld-servers.net.com.            172800     IN    NS    j.gtld-servers.net.com.             172800    IN     NS    k.gtld-servers.net.com.             172800    IN    NS     l.gtld-servers.net.com.            172800     IN    NS    m.gtld-servers.net.;;  received 491 bytes from 198.97.190.53#53 (198.97.190.53)  in 352 ms# #解析com的一共有13个DNS服务器,. COM's a.gtld-servers.net is responsible for parsing 51cto.com.        172800   here.   IN    NS    ns1.dnsv2.com.51cto.com.         172800    IN    NS     ns2.dnsv2.com.;;  received 249 bytes from 192.54.112.30#53 (192.54.112.30)  in 272 ms# #解析   ns1.dnsv2.com is responsible for the final a record parsing www.51cto.com.        600     in    cname    web.dns.51cto.com.web.dns.51cto.com.     600    IN    CNAME     gf.dns.51cto.com.gf.dns.51cto.com.    600    in     a    218.11.0.9151cto.coM.        86400    in    ns     ns2.dnsv2.com.51cto.com.        86400     IN    NS    ns1.dnsv2.com.;;  received 162 bytes from 115.236.151.178#53 (115.236.151.178)  in 139 ms

Report:

Common methods of HTTP requests

http Method function Description
GET
The client requests the specified resource information and the server returns the specified resource
HEAD
requests only HTTP headers in a warm-up response
POST
Submit the client's data to the server, such as a registration form
PUT
Replaces the specified document content with data transferred from the client to the server
DELETE
Requesting the server to delete the resource identified by Request-uri
MOVE
Requests the server to move the specified page to another network address


Different range of status codes and their corresponding applications

Status Code range function Description
100-199
Used to specify certain actions for the client response
200-299
Used to indicate a successful request
300-399
Used for files that have been moved and are often included in the locator header information to specify new address information
400-499
Used to indicate client-side errors
500-599
Errors to indicate the server



Common status codes and their corresponding functions in the working environment
Status code
Detailed Description Description
200-ok
The server successfully returns the Web page, which is a successful HTTP request that returns a standard status code
301-moved Permanently
Permanent jump, the requested page will permanently jump to the new location set, for example: Jump from www.baidu.com to www.qq.com
403-forbidden
No access, although this request is legitimate, but the server side because of matching the pre-set rules and refused to respond to the client's request, such problems are generally caused by improper configuration of server or server permissions
404-not Found
The server could not find the specified page for the client request, possibly due to a client requesting a resource that does not exist on the server
500-internal Server Error
Internal service error, the server encountered unexpected situation, unable to complete the customer request. This is a general error, usually caused by Server Setup or internal program problems. For example, if SELinux is turned on and there is no rule permission for HTTP settings, client access is 500
502-bad Gateway
A bad gateway, typically a proxy server requesting a backend service, is unavailable to the backend service or does not complete the response to the gateway server. This is usually caused by a problem with the node under the reverse proxy server
503-service unavailable
The service is currently unavailable, possibly due to server overloading or downtime maintenance, or to a node that does not have a service behind the reverse proxy server
504-gateway Timeout
When the network timeout, when the Gateway Proxy server requests the backend service, the backend service does not complete the processing request within a certain time. Most are server overloads that cause no data to be returned to the front-end proxy server within a specified time


You can view the numeric status code for the HTTP response on the Linux command line via the Curl command:

[[email protected] ~]# curl-i wwww.baidu.comhttp/1.1 302 Found # #302 is status code DATE:SAT, Oct 14:56:01 gmtserver:a Pachelocation:http://www.baidu.com/cache-control:max-age=86400expires:sun, 14:56:01 GMTConnection: keep-alivecontent-type:text/html; Charset=iso-8859-1[[email protected] ~]# curl-i-s-w%{http_code}-o/dev/null www.baidu.com200 # #200即是状态码



This article is from the "Richy Operations Log" blog, please make sure to keep this source http://richylu.blog.51cto.com/1481674/1858330

Explanation of HTTP Access Service

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.