Linux   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了varnish配置反向代理服务器大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

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配置反向代理服务器所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。