企业实战--Varnish详解及反向代理实现、负载均衡实现、cdn加速实现

水深无声 2023-07-06 13:28 50阅读 0赞

一、Varnish详解

Varnish是什么

Varnish作用是访问web速度的web加速器,被安装在web服务器之前,从而缓存web服务器的应用程序和数据,最后相应客户的请求。 功能与Squid服务器相似,都可以用来做HTTP缓存。与Squid不同之处在于,Squid是从硬盘读取缓存的数据,而Varnish把数据存放在内存中,直接从读取内存,避免了频繁在内存、磁盘中交换文件,所以Varnish要相对更高效,但也有缺点,内存中的缓存在服务器重启后会丢失。

Varnish架构:

在这里插入图片描述

Varnish初始化过程

varnish启动会产生两个进程:master进程 和 child进程
master进程:master进程负责启动工作,master进程会读取配置文件,vcl文件编译,varnish监控,初始化varnish,提供varnish管理接口,根据指定的配置信息做出相应的动作,例如管理员在配置文件中分配了2G内存大小,它就会在内存中创建2G的存储空间; master进程还会创建并管理child进程。
child进程: child进程来处理后续任务,它会分配一些线程来执行不同的工作,
例如:
(1). 接受http请求
(2).为缓存对象分配存储空间
(3).清除过期缓存对象
(4). 释放空间 碎片整理

分配缓存过程

有一个对象需要缓存时,根据这个对象的大小,到空闲缓存区中查找大小最适合的空闲块,找到后就把这个对象放进去
如果这个对象没有填满这个空闲块,就把剩余的空间做为一个新的空闲块
如果空闲缓存区中没地方了,就要先删除一部分缓存来腾出地方,删除是根据最近最少使用原则。

释放缓存过程

有一个线程来负责缓存的释放工作,他定期检查缓存中所有对象的生存周期,如果某个对象在指定的时间段内没有被访问,就把这个对象删除,释放其占用的缓存空间; 释放空间后,检查一下临近的内存空间是否是空闲的,如果是,就整合为一个更大的空闲块,实现空间碎片的整理

VCL(varnish configuration Langage)语言相关:

1)、VCL概念
VCL语言被使用在default.vcl这个文件中,用来设置varnish服务器对后端web服务器加速的一些规则; vcl是一种区域配置语言。在执行vcl时,varnish会将vcl语言转化未二进制代码; default.vcl文件中的vcl语言被分为多个子程序, 不同的子程序在不同的时间点执行,比如有的子程序在接收到客户端请求时执行,有的子程序在接收到后端服务器的文件时执行。
VCL处理过程:
在这里插入图片描述
2)、 backend servers(后端服务器)
一般来说就代表web服务器,提供varnish加速的内容,即varnish缓存内容的源头。
/etc/varnish/default.vcl(varnish主配置文件)文件中会配置相关信息和规则,告诉varnish服务器应该去哪里寻找缓存的内容

3)、vcl_recv
该子程序在请求的开始被调用,在接收、解析了客户端的请求后,该子程序会决定是否响应请求、怎么响应请求以及使用哪个后台服务器响应请求。

  • 修改client请求,以减少缓存决策时的差异性
  • 根据client请求,决定缓存策略
  • 重定向请求
  • 决定处理请求的backend(即后端webserver)

4)、vcl_deliver

在缓存数据将要发送到客户端时调用

5)、actions:

主要有以下动作 :

pass:当一个请求被 pass 后,这个请求将通过 varnish 转发到后端服务器,
但是它不会被缓存。pass 可以放在 vcl_recv 和 vcl_fetch 中。
lookup:当一个请求在 vcl_recv 中被 lookup 后,varnish 将从缓存中提取数
据,如果缓存中没有数据,将被设置为 pass,不能在 vcl_fetch 中设置 lookup。
pipe:pipe 和 pass 相似,都要访问后端服务器,不过当进入 pipe 模式后,在
此连接未关闭前,后续的所有请求都发到后端服务器
deliver:请求的目标被缓存,然后发送给客户端

6)、3个重要的数据结构:RequestsResponsesobjects

req:请求目标,当 varnish 接收到一个请求,这时 req object 就被创建了,
你在 vcl_recv 中的大部分工作,都是在 req object 上展开的。
beresp:后端服务器返回的目标,它包含返回的头信息,你在 vcl_fetch 中的大部分工作都是在 beresp object 上开展的。
obj:被 cache 的目标,只读的目标被保存于内存中,obj.ttl 的值可修改,其他的只能读。

二、Varnish反向代理实现

本此实验需要两台虚拟机:
主机名:server1:varnish服务器,ip:172.25.63.1
主机名:server2:web网站服务器 ip:172.25.63.2,
物理机(客户端)

varnish下载

可在varnish官网下载:
http://varnish-cache.org/releases/index.html
本次实验所使用版本为 6.3.1

redhat安装varnish

redhat安装varnish需要解决依赖性:

  1. yum install -y jemalloc-3.6.0-1.el7.x86_64.rpm varnish-6.3.1-1.el7.x86_64.rpm

varnish 主配置文件:/etc/varnish/default.vcl

优化varnish

为了使varnish工作在最优状态下,varnish要求(在/usr/lib/systemd/system/varnish.service文件中查看):

  • 系统中最大打开文件数为131072
  • 其需要锁定的内存空间是82M

因此需要进行如下操作:
查看系统最大文件数:

  1. [root@server1 ~]# sysctl -a | grep file
  2. fs.file-max = 47100
  3. fs.file-nr = 960 0 47100
  4. fs.xfs.filestream_centisecs = 3000

达不到要求的文件数,因此首先需要增大虚拟机的内存,增大虚拟机的内存后即可实现:

  1. [root@server1 ~]# sysctl -a | grep file
  2. fs.file-max = 149289 #大于131072
  3. fs.file-nr = 1056 0 149289
  4. fs.xfs.filestream_centisecs = 3000

之后修改系统限制文件:

  1. vim /etc/security/limits.conf
  2. 写入:
  3. 62 varnish - nofile 131072
  4. 63 varnish - memlock 82000

实现varnish反向代理

1.修改varnish主配置文件
在server1:

  1. vim /etc/varnish/default.vcl
  2. 修改:
  3. 17 backend web1 {
  4. 18 .host = "172.25.63.2"; #web服务器ip
  5. 19 .port = "80"; #Apache端口
  6. 20 }

2.配置web服务器

在server2安装apache并编写测试页:

  1. [root@server2 ~]# yum install httpd -y
  2. [root@server2 ~]# cd /var/www/html/
  3. [root@server2 html]# vim index.html
  4. [root@server2 html]# cat index.html
  5. server2
  6. [root@server2 ~]# systemctl start httpd

3.修改varnish端口

用户访问web服务器也是80端口,若要做反向代理,即表示用户访问varnish服务器是80端口。故需要更改varnish端口:
在server1:

  1. vim /usr/lib/systemd/system/varnish.service
  2. 修改:
  3. 23
  4. 24 ExecStart=/usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/defaul t.vcl -s malloc,256m

4.打开varnish

在server1:

  1. [root@server1 ~]# systemctl start varnish

查看开启端口:

  1. [root@server1 ~]# netstat -antlupe | grep varnish
  2. tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 42013 2742/varnishd
  3. tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 0 42075 2742/varnishd
  4. tcp6 0 0 :::80 :::* LISTEN 0 42014 2742/varnishd
  5. tcp6 0 0 ::1:6082 :::* LISTEN 0 42074 2742/varnishd

5.测试

在客户端(物理机):

  1. [root@foundation63 ~]# curl 172.25.63.1
  2. server2
  3. [root@foundation63 ~]# curl 172.25.63.1
  4. server2
  5. [root@foundation63 ~]# curl 172.25.63.1
  6. server2
  7. [root@foundation63 ~]# curl 172.25.63.1
  8. server2
  9. [root@foundation63 ~]# curl 172.25.63.1
  10. server2
  11. [root@foundation63 ~]# curl 172.25.63.1
  12. server2

反向代理成功实现

三、判断是否加速

在varnish服务器主配置文件vcl_deliver模块中写入:

  1. [root@server1 ~]# vim /etc/varnish/default.vcl
  2. 70 sub vcl_deliver {
  3. 71 # Happens when we have all the pieces we need, and are about to send the
  4. 72 # response to the client.
  5. 73 #
  6. 74 # You can do accounting or modifying the final object here.
  7. 75 if (obj.hits > 0) {
  8. 76 set resp.http.X-Cache = "HIT from redhat cache"; #响应报文首部
  9. 77 }
  10. 78 else {
  11. 79 set resp.http.X-Cache = "MISS from redhat cache";
  12. 80 }
  13. 81 return(deliver);
  14. 82
  15. 83
  16. 84 }
  17. [root@server1 ~]# systemctl restart varnish #重启服务

测试:
在客户端(物理机中:)

  1. [root@foundation63 ~]# curl -I 172.25.63.1
  2. HTTP/1.1 200 OK
  3. Date: Wed, 19 Feb 2020 16:24:05 GMT
  4. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  5. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  6. ETag: "8-59edbd8fa9ad0"
  7. Content-Length: 8
  8. Content-Type: text/html; charset=UTF-8
  9. X-Varnish: 32770
  10. Age: 0
  11. Via: 1.1 varnish (Varnish/6.3)
  12. X-Cache: MISS from redhat cache #第一次访问是MISS
  13. Accept-Ranges: bytes
  14. Connection: keep-alive
  15. [root@foundation63 ~]# curl -I 172.25.63.1
  16. HTTP/1.1 200 OK
  17. Date: Wed, 19 Feb 2020 16:24:05 GMT
  18. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  19. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  20. ETag: "8-59edbd8fa9ad0"
  21. Content-Length: 8
  22. Content-Type: text/html; charset=UTF-8
  23. X-Varnish: 7 32771
  24. Age: 1
  25. Via: 1.1 varnish (Varnish/6.3)
  26. X-Cache: HIT from redhat cache #之后所有访问都是HIT(若没有清除缓存)
  27. Accept-Ranges: bytes
  28. Connection: keep-alive

表示加速成功

四、varnish缓存清除

1.命令

  1. [root@server1 ~]# varnishadm ban req.url "~" / #清除所有
  2. [root@server1 ~]# varnishadm ban req.url "~" /index.html #清除指定页面

ban表示清理缓存中满足表达式的对象

2.使用varnish操作界面

  1. [root@server1 ~]# varnishadm
  2. 200
  3. -----------------------------
  4. Varnish Cache CLI 1.0
  5. -----------------------------
  6. Linux,3.10.0-514.el7.x86_64,x86_64,-junix,-smalloc,-sdefault,-hcritbit
  7. varnish-6.3.1 revision 6e96ff048692235e64565211a38c41432a26c055
  8. Type 'help' for command list.
  9. Type 'quit' to close CLI session.
  10. varnish> ban req.url ~ "/index.html" #清除缓存
  11. 200
  12. varnish> quit
  13. 500
  14. Closing CLI connection

五、varnish负载均衡实现

本此实验需要两台虚拟机:
主机名:server1:varnish服务器,ip:172.25.63.1
主机名:server2:web1网站服务器 ip:172.25.63.2,
主机名:server3:web2网站服务器 ip:172.25.63.3,
物理机(客户端)

1.修改主配置文件

在server1中:

  1. [root@server1 ~]# vim /etc/varnish/default.vcl
  2. 17 backend web1 {
  3. 18 .host = "172.25.63.2";
  4. 19 .port = "80";
  5. 20 }
  6. 21
  7. 22 backend web2 {
  8. 23 .host = "172.25.63.3";
  9. 24 .port = "80";
  10. 25 }

2.配置web2服务器
在server3安装apache并编写测试页:

  1. [root@server3 ~]# yum install httpd -y
  2. [root@server3 ~]# cd /var/www/html/
  3. [root@server3 html]# vim index.html
  4. [root@server3 html]# cat index.html
  5. server3
  6. [root@server2 ~]# systemctl start httpd

3.编写rev_recv模块:

  1. [root@server1 ~]# vim /etc/varnish/default.vcl
  2. 38 sub vcl_recv {
  3. 39 # Happens before we check if we have this in cache already.
  4. 40 #
  5. 41 # Typically you clean up the request here, removing cookies you don't ne ed,
  6. 42 # rewriting the request, etc.
  7. 43 if (req.http.host ~ "^(www.)?westos.org") {
  8. 44 set req.http.host = "www.westos.org";
  9. 45 set req.backend_hint = web1;
  10. 46
  11. 47 } elsif (req.http.host ~ "^bbs.westos.org") {
  12. 48 set req.backend_hint = web2;
  13. 49 } else {
  14. 50 return (synth(405));
  15. 51 }
  16. 52 }

此时,在客户端进行测试:

  1. [root@foundation63 ~]# curl www.westos.org
  2. server2
  3. [root@foundation63 ~]# curl westos.org
  4. server2
  5. [root@foundation63 ~]# curl bbs.westos.org
  6. server3

若无法解析域名,需要在客户端编辑域名解析文件:

  1. [root@foundation63 ~]# vim /etc/hosts
  2. 新增:
  3. 172.25.63.1 www.westos.org bbs.westos.org westos.org

4.负载均衡

使客户端访问 www.westos.org/westos.org时指向server2/server3,访问bbs.westos.org时指向server3

即让server3负担server2的一部分访问压力,该实验的负载均衡采用轮询机制:即每个服务器负担一次访问

要使server3发布两个页面,需要在server3上设置虚拟主机

5.设置server3虚拟主机以及发布页面

server3上:
设置虚拟主机:

  1. [root@server3 ~]# vim /etc/httpd/conf.d/vhost.conf
  2. 写入:
  3. <VirtualHost *:80>
  4. DocumentRoot /www
  5. ServerName www.westos.org
  6. </VirtualHost>
  7. <Directory "/www">
  8. Require all granted
  9. </Directory>
  10. <VirtualHost *:80>
  11. DocumentRoot /bbs
  12. ServerName bbs.westos.org
  13. </VirtualHost>
  14. <Directory "/bbs">
  15. Require all granted
  16. </Directory>

新建发布页面:

  1. [root@server2 ~]# mkdir /www
  2. [root@server2 ~]# mkdir /bbs
  3. [root@server3 ~]# vim /www/index.html
  4. [root@server3 ~]# cat /www/index.html
  5. server3:www.westos.org #为了区分因此使用和server2不同的
  6. [root@server3 ~]# vim /bbs/index.html
  7. [root@server3 ~]# cat /bbs/index.html
  8. server3:bbs.westos.org

6.定义负载均衡

在server1:

  1. [root@server1 ~]# vim /etc/varnish/default.vcl
  2. 13 vcl 4.1;
  3. 14 import directors from "/usr/lib64/varnish/vmods/libvmod_directors.so"; #导入模块
  4. 15 # Default backend definition. Set this to point to your content server.
  5. ......
  6. 27 sub vcl_init { #定义负载均衡
  7. 28 new lb = directors.round_robin();
  8. 29 lb.add_backend(web1);
  9. 30 lb.add_backend(web2);
  10. 31 }
  11. 38 sub vcl_recv {
  12. 39 # Happens before we check if we have this in cache already.
  13. 40 #
  14. 41 # Typically you clean up the request here, removing cookies you don't need,
  15. 42 # rewriting the request, etc.
  16. 43 if (req.http.host ~ "^(www.)?westos.org") {
  17. 44 set req.http.host = "www.westos.org";
  18. 45 set req.backend_hint = lb.backend(); #加入负载均衡
  19. 46 return (pass); #清理缓存
  20. 47 } elsif (req.http.host ~ "^bbs.westos.org") {
  21. 48 set req.backend_hint = web2;
  22. 49 } else {
  23. 50 return (synth(405));
  24. 51 }
  25. 52 }

保存后重启varnish:

  1. [root@server1 ~]# systemctl restart varnish

7.测试负载均衡

在客户端(物理机):

  1. [root@foundation63 ~]# curl www.westos.org
  2. server2
  3. [root@foundation63 ~]# curl www.westos.org
  4. server3:www.westos.org
  5. [root@foundation63 ~]# curl www.westos.org
  6. server2
  7. [root@foundation63 ~]# curl www.westos.org
  8. server3:www.westos.org
  9. [root@foundation63 ~]# curl bbs.westos.org
  10. server3:bbs.westos.org

六、varnish cdn推送平台 通过bansys实现

我们在实现CDN高速缓存时有些时候通过命令等对CDN的管理有些麻烦,我们就可以使用CDN推送的方法同步后端服务内容

1.安装bansys

在varnish服务器(server1)
首先需要安装:

  1. yum install php unzip httpd -y
  2. unzip bansys.zip -d /var/www/html/
  3. mv /var/www/html/bansys/* /var/www/html/

2.更改端口

varnish服务器(server1)上的80端口已经被varnish占了,因此如果还要运行apache的话就需要更改apache的端口:

  1. [root@server1 ~]# vim /etc/httpd/conf/httpd.conf
  2. 41 #Listen 12.34.56.78:80
  3. 42 Listen 8080 #将默认的80端口改为8080
  4. 43
  5. 44 #
  6. 45 # Dynamic Shared Object (DSO) Support

3.更改bansys主配置文件

在varnish服务器(server1)

  1. [root@server1 ~]# cd /var/www/html/
  2. [root@server1 html]# ls
  3. bansys class_socket.php config.php index.php purge_action.php static
  4. [root@server1 html]# vim config.php
  5. [root@server1 html]# cat config.php
  6. <?php
  7. //varnish主机列表
  8. //可定义多个主机列表
  9. $var_group1 = array(
  10. 'host' => array('172.25.63.1'),
  11. 'port' => '8080',
  12. );
  13. //varnish群组定义
  14. //对主机列表进行绑定
  15. $VAR_CLUSTER = array(
  16. 'www.westos.org' => $var_group1,
  17. );
  18. //varnish版本
  19. //2.x和3.x推送命令不一样
  20. $VAR_VERSION = "3";
  21. ?>

之后开启apache服务:

  1. [root@server1 html]# systemctl start httpd

4.推送
在客户端浏览器输入: http://172.25.63.1:8080/
出现如下界面表示安装成功:
在这里插入图片描述5.更改varnish主配置文件

在varnish服务器(server1)中:

  1. [root@server1 html]# vim /etc/varnish/default.vcl
  2. 33 acl westos {
  3. 34 "127.0.0.1";
  4. 35 "172.25.63.0"/24;
  5. 36 }
  6. 38 sub vcl_recv {
  7. 39 # Happens before we check if we have this in cache already.
  8. 40 #
  9. 41 # Typically you clean up the request here, removing cookies you don't need,
  10. 42 # rewriting the request, etc.
  11. 52 if (req.method == "BAN") {
  12. 53 if (!client.ip ~ westos) {
  13. 54 return(synth(405,"Not Allowed"));
  14. 55 }
  15. 56 ban("req.url ~ " + req.url);
  16. 57 return(purge); #取出相应缓存内容然后清除
  17. 58 }
  18. 59
  19. 60
  20. 61 }
  21. [root@server1 html]# systemctl restart varnish #重启服务

6.推送测试

更改客户端解析:

  1. [root@foundation63 ~]# vim /etc/hosts
  2. [root@foundation63 ~]# cat /etc/hosts
  3. 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  4. ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  5. 172.25.254.116 www.haha.org news.haha.org music.haha.org login.westos.org
  6. #172.25.63.1 www.westos.org bbs.westos.org westos.org #将上个实验的解析注释掉
  7. 172.25.63.1 www.westos.org #新增解析

测试:

推送前:

  1. [root@foundation63 ~]# curl -I www.westos.org
  2. HTTP/1.1 200 OK
  3. Date: Wed, 19 Feb 2020 19:22:01 GMT
  4. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  5. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  6. ETag: "8-59edbd8fa9ad0"
  7. Content-Length: 8
  8. Content-Type: text/html; charset=UTF-8
  9. X-Varnish: 2
  10. Age: 0
  11. Via: 1.1 varnish (Varnish/6.3)
  12. X-Cache: MISS from redhat cache
  13. Accept-Ranges: bytes
  14. Connection: keep-alive
  15. [root@foundation63 ~]# curl -I www.westos.org
  16. HTTP/1.1 200 OK
  17. Date: Wed, 19 Feb 2020 19:22:01 GMT
  18. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  19. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  20. ETag: "8-59edbd8fa9ad0"
  21. Content-Length: 8
  22. Content-Type: text/html; charset=UTF-8
  23. X-Varnish: 5 3
  24. Age: 2
  25. Via: 1.1 varnish (Varnish/6.3)
  26. X-Cache: HIT from redhat cache
  27. Accept-Ranges: bytes
  28. Connection: keep-alive
  29. [root@foundation63 ~]# curl -I www.westos.org
  30. HTTP/1.1 200 OK
  31. Date: Wed, 19 Feb 2020 19:22:01 GMT
  32. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  33. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  34. ETag: "8-59edbd8fa9ad0"
  35. Content-Length: 8
  36. Content-Type: text/html; charset=UTF-8
  37. X-Varnish: 32770 3
  38. Age: 3
  39. Via: 1.1 varnish (Varnish/6.3)
  40. X-Cache: HIT from redhat cache #第一次MISS后之后每次都是HIT
  41. Accept-Ranges: bytes
  42. Connection: keep-alive

推送:
在这里插入图片描述在这里插入图片描述
推送后:

  1. [root@foundation63 ~]# curl -I www.westos.org
  2. HTTP/1.1 200 OK
  3. Date: Wed, 19 Feb 2020 19:27:34 GMT
  4. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  5. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  6. ETag: "8-59edbd8fa9ad0"
  7. Content-Length: 8
  8. Content-Type: text/html; charset=UTF-8
  9. X-Varnish: 9
  10. Age: 0
  11. Via: 1.1 varnish (Varnish/6.3)
  12. X-Cache: MISS from redhat cache #直接就是MISS
  13. Accept-Ranges: bytes
  14. Connection: keep-alive

7.推送特定页面

推送前:

  1. [root@foundation63 ~]# curl -I www.westos.org/index.html
  2. HTTP/1.1 200 OK
  3. Date: Wed, 19 Feb 2020 19:29:34 GMT
  4. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  5. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  6. ETag: "8-59edbd8fa9ad0"
  7. Content-Length: 8
  8. Content-Type: text/html; charset=UTF-8
  9. X-Varnish: 21
  10. Age: 0
  11. Via: 1.1 varnish (Varnish/6.3)
  12. X-Cache: MISS from redhat cache #第一次是MISS,之后全是HIT
  13. Accept-Ranges: bytes
  14. Connection: keep-alive
  15. [root@foundation63 ~]# curl -I www.westos.org/index.html
  16. HTTP/1.1 200 OK
  17. Date: Wed, 19 Feb 2020 19:29:34 GMT
  18. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  19. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  20. ETag: "8-59edbd8fa9ad0"
  21. Content-Length: 8
  22. Content-Type: text/html; charset=UTF-8
  23. X-Varnish: 32776 22
  24. Age: 2
  25. Via: 1.1 varnish (Varnish/6.3)
  26. X-Cache: HIT from redhat cache
  27. Accept-Ranges: bytes
  28. Connection: keep-alive
  29. [root@foundation63 ~]# curl -I www.westos.org/index.html
  30. HTTP/1.1 200 OK
  31. Date: Wed, 19 Feb 2020 19:29:34 GMT
  32. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  33. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  34. ETag: "8-59edbd8fa9ad0"
  35. Content-Length: 8
  36. Content-Type: text/html; charset=UTF-8
  37. X-Varnish: 24 22
  38. Age: 3
  39. Via: 1.1 varnish (Varnish/6.3)
  40. X-Cache: HIT from redhat cache
  41. Accept-Ranges: bytes
  42. Connection: keep-alive

推送内容填写:/index.html
推送后:

  1. [root@foundation63 ~]# curl -I www.westos.org/index.html
  2. HTTP/1.1 200 OK
  3. Date: Wed, 19 Feb 2020 19:31:22 GMT
  4. Server: Apache/2.4.6 (Red Hat Enterprise Linux)
  5. Last-Modified: Tue, 18 Feb 2020 16:05:58 GMT
  6. ETag: "8-59edbd8fa9ad0"
  7. Content-Length: 8
  8. Content-Type: text/html; charset=UTF-8
  9. X-Varnish: 26
  10. Age: 0
  11. Via: 1.1 varnish (Varnish/6.3)
  12. X-Cache: MISS from redhat cache #直接就是MISS
  13. Accept-Ranges: bytes
  14. Connection: keep-alive

发表评论

表情:
评论列表 (有 0 条评论,50人围观)

还没有评论,来说两句吧...

相关阅读