45 HTTPプロトコル

1.httpは何ですか

ユーザーは何が起こったか、ブラウザのプロセスにURLを入力して
サイトにアクセスするフローユーザーを

DNS解析过程,     域名对应的ip地址          
TCP/ip 三次握手, 与服务器建立链接
HTTP请求报文,    用户向服务器要东西(图片 页面)
HTTP响应报文,    把你要的内容给你
TCP/ip 四次挥手, 与服务器断开连接

16952149-6909156950c4b242.png
画像

詳細な分析プロセス2.DNS

16952149-16dffa6c5ada0d4f.png
画像
16952149-900c6b2f389713e6.png
画像

DNS名前解決のプロセス

16952149-3d9f6cfb1ab0cacc.png
画像
16952149-55f1ba95a59a9872.png
画像

窓ローカルホストファイル:

16952149-cbcb8d38b51dce63.png
画像

ドメイン構造(階層)

www.baidu.com.  (最后的点)
[d:\~]$ ipconfig /displaydns
    查看DNS缓存
[d:\~]$ ipconfig /display
    释放DNS缓存
[d:\~]$ ipconfig /flushdns
    清空DNS缓存

使用するコマンドを3.dig

https://www.imooc.com/article/26971?block_id=tuijian_wz
DNSドメインネームサーバは、ホストアドレス情報が照会からDIGコマンドが主に使用されている
提供のyumを掘る
クエリインストールパッケージを
yumを-yバインド-utilsのインストール
バインド-utilsのを掘るマウント

あなたwww.baidu.com www.jd.com

DNSレコードタイプ

あなたは+トレースwww.baidu.com

记录1个对应关系
A记录
    域名 ip地址记录
CNAME记录
    别名记录
MX记录
    邮件使用

16952149-789e32e629881fa9.png
画像

nslookupコマンドは、パッケージを掘るに属し

[10:25 root@web01 ~]# rpm -qf `which nslookup`
bind-utils-9.9.4-73.el7_6.x86_64
[10:27 root@web01 ~]# nslookup
> www.baidu.com
Server:     10.0.0.254
Address:    10.0.0.254#53

Non-authoritative answer:
www.baidu.com   canonical name = www.a.shifen.com.
Name:   www.a.shifen.com
Address: 39.156.66.14
Name:   www.a.shifen.com
Address: 39.156.66.18
> 

ホストは、パッケージを掘るに属し

[10:28 root@web01 ~]# host www.baidu.com
www.baidu.com is an alias for www.a.shifen.com.
www.a.shifen.com has address 39.156.66.18
www.a.shifen.com has address 39.156.66.14

Webサイトでは、プロセスを設定します

云服务器
    搭建LNMP环境部署 wordpress
购买域名
    备案(网站基本性信息 个人信息 提交给信息管理局)
配置DNS解析(记录)
    记录类型
    主机记录
    记录值
    TTL  存活时间(缓存时间)

16952149-46d1e9e4d755cdaf.png
画像
16952149-1c394648e70c87e0.png
画像

HTTPリクエストとレスポンスのプロセス:

16952149-dff8b0da7cb793b7.png
画像
16952149-231e7b6e3ab712b1.png
画像
16952149-c0ca5dcfe009fbc8.png
画像

クライアントの要求:

16952149-5a4939e55038b7d7.png
画像

サーバーの応答:

16952149-5b265bb8cf6a32bb.png
画像

クライアントの要求とサーバの応答処理:

-vカールwww.baicu.com

[11:31 root@web01 ~]# curl -v www.baidu.com/index.html
* About to connect() to www.baidu.com port 80 (#0)   \\DNS解析
*   Trying 39.156.66.14...
* Connected to www.baidu.com (39.156.66.14) port 80 (#0)   \\Tcp三次握手
> GET /index.html HTTP/1.1    \\http请求报文 ,请求起始行
> User-Agent: curl/7.29.0     \\用户的浏览器
> Host: www.baidu.com         \\请求域名
> Accept: */*   
>                           \\空行
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Connection: Keep-Alive
< Content-Length: 2381
< Content-Type: text/html
< Date: Mon, 03 Jun 2019 03:32:03 GMT
< Etag: "588604c8-94d"
< Last-Modified: Mon, 23 Jan 2017 13:27:36 GMT
< Pragma: no-cache
< Server: bfe/1.0.8.18
< Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
< 
<!DOCTYPE html>
<!--STATUS OK--><html> <head><meta http-equiv=content-type 
content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible 
content=IE=Edge><meta content=always name=referrer><link rel=stylesheet 
type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>
百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div 
....

16952149-63d9762f7115ec64.png
画像

wgetの--debug www.baidu.com

[12:06 root@web01 ~]# wget --debug www.baidu.com
DEBUG output created by Wget 1.14 on linux-gnu.

URI encoding = ‘UTF-8’
Converted file name 'index.html' (UTF-8) -> 'index.html' (UTF-8)
Converted file name 'index.html' (UTF-8) -> 'index.html' (UTF-8)
--2019-06-03 12:07:08--  http://www.baidu.com/
Resolving www.baidu.com (www.baidu.com)... 39.156.66.18, 39.156.66.14
Caching www.baidu.com => 39.156.66.18 39.156.66.14
Connecting to www.baidu.com (www.baidu.com)|39.156.66.18|:80... connected.
Created socket 3.
Releasing 0x000000000138e9a0 (new refcount 1).

---request begin---
GET / HTTP/1.1
User-Agent: Wget/1.14 (linux-gnu)
Accept: */*
Host: www.baidu.com
Connection: Keep-Alive

---request end---
HTTP request sent, awaiting response... 
---response begin---
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: Keep-Alive
Content-Length: 2381
Content-Type: text/html
Date: Mon, 03 Jun 2019 04:07:07 GMT
Etag: "588604c8-94d"
Last-Modified: Mon, 23 Jan 2017 13:27:36 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/

---response end---
200 OK
cdm: 1 2 3 4 5 6 7 8
Stored cookie baidu.com -1 (ANY) / <permanent> <insecure> [expiry 2019-06-04 12:07:08] BDORZ 27315
Registered socket 3 for persistent reuse.
Length: 2381 (2.3K) [text/html]
Saving to: ‘index.html’

100%[========================================>] 2,381       --.-K/s   in 0s      

2019-06-03 12:07:08 (29.2 MB/s) - ‘index.html’ saved [2381/2381]

Wiresharkのパケットキャプチャを※

16952149-96e3f2da9b41d6a0.png
画像
16952149-56ca66ba48371565.png
画像

要求プロセス

16952149-7359ef3d2f67d808.png
画像

応答処理

16952149-4af98253fbbd8610.png
画像

ステータスコードの意味:

16952149-89abe270f6ebbc73.png
画像
16952149-22397c9341fa791c.png
画像
16952149-a29fae141a0f4a5a.png
画像
16952149-91f34f84d708de2e.png
画像
16952149-0265750e7e9dd145.png
画像

ます。https://www.jianshu.com/p/8d07cfdbae09で再現

おすすめ

転載: blog.csdn.net/weixin_33670786/article/details/91264384