varnish配置反向代理服务器

varnish配置反向代理服务器,第1张

概述Step1:下载源码 [[email protected] ~]# git clone https://github.com/varnishcache/varnish-cache Step2:安装 [[email protected] ~]# cd varnish-cache/ [[email protected] varnish-cache]# sh autogen.sh [[email pro

Step1:下载源码

[[email protected] ~]# git clone https://github.com/varnishcache/varnish-cache

Step2:安装

[[email protected] ~]# cd varnish-cache/

[[email protected] varnish-cache]# sh autogen.sh

[[email protected] varnish-cache]# sh configure

[[email protected] varnish-cache]# make

[[email protected] varnish-cache]# make install

Step3:修改配置文件

[[email protected] varnish-cache]# cp /usr/local/varnish/share/doc/varnish/example.vcl /usr/local/varnish/default.vcl

 [[email protected] varnish-cache]# vi /usr/local/varnish/default.vcl 

backend default {
.host = "10.10.1.10";        #修改后端服务器IP和端口
.port = "80";
}

Step4:启动服务

[[email protected] varnish-cache]# /usr/local/sbin/varnishd -f /usr/local/varnish/default.vcl
DeBUG: Version: varnish-trunk revision d32906f86aeee1fe462ced9897a31c6d40110ea8
DeBUG: Platform: linux,3.10.0-957.el7.x86_64,x86_64,-jnone,-sdefault,-hcritbit
DeBUG: Child (27715) Started
[[email protected] varnish-cache]#

Step5:查看日志

[[email protected] varnish-cache]# /usr/local/bin/varnishlog
* << Request >> 32774
- Begin req 32773 rxreq
- Timestamp Start: 1570369307.901920 0.000000 0.000000
- Timestamp Req: 1570369307.901920 0.000000 0.000000
- VCL_use boot
- ReqStart 10.10.1.1 52299 a0
- ReqMethod GET
- ReqURL /index.PHP/archives/3/
- ReqProtocol http/1.1
- Reqheader Host: 10.10.1.110
- Reqheader Connection: keep-alive
- Reqheader upgrade-insecure-requests: 1
- Reqheader User-Agent: Mozilla/5.0 (windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/77.0.3865.90 Safari/537.36
- Reqheader Accept: text/HTML,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
- Reqheader Referer: http://10.10.1.110/index.PHP/archives/3/
- Reqheader Accept-EnCoding: gzip,deflate
- Reqheader Accept-Language: zh-CN,zh;q=0.9
- Reqheader X-Forwarded-For: 10.10.1.1
- VCL_call RECV
- ReqUnset Host: 10.10.1.110
- Reqheader host: 10.10.1.110
- VCL_return hash
- ReqUnset Accept-EnCoding: gzip,deflate
- Reqheader Accept-EnCoding: gzip
- VCL_call HASH
- VCL_return lookup
- Hit 32772 98.796069 10.000000 0.000000
- VCL_call HIT
- VCL_return deliver
- RespProtocol http/1.1
- RespStatus 200
- RespReason OK
- Respheader Date: Sun,06 Oct 2019 13:41:24 GMT
- Respheader Server: Apache/2.4.6 (CentOS) PHP/5.4.16
- Respheader X-Powered-By: PHP/5.4.16
- Respheader X-Pingback: http://10.10.1.110/index.PHP/action/xmlrpc
- Respheader Content-Type: text/HTML; charset=UTF-8
- Respheader X-Varnish: 32774 32772

[[email protected] varnish-cache]# /usr/local/bin/varnishstat

总结

以上是内存溢出为你收集整理的varnish配置反向代理服务器全部内容,希望文章能够帮你解决varnish配置反向代理服务器所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/yw/1022874.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-23
下一篇 2022-05-23

发表评论

登录后才能评论

评论列表(0条)

保存