ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

varnish配置反向代理服务器

2019-10-06 21:50:26  阅读:209  来源: 互联网

标签:varnish squid ReqHeader cache 代理服务器 反向 10.10 root


Step1:下载源码

[root@squid ~]# git clone https://github.com/varnishcache/varnish-cache

Step2:安装

[root@squid ~]# cd varnish-cache/

[root@squid varnish-cache]# sh autogen.sh

[root@squid varnish-cache]# sh configure

[root@squid varnish-cache]# make

[root@squid varnish-cache]# make install

Step3:修改配置文件

[root@squid varnish-cache]# cp /usr/local/varnish/share/doc/varnish/example.vcl /usr/local/varnish/default.vcl

 [root@squid varnish-cache]# vi /usr/local/varnish/default.vcl 

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

Step4:启动服务

[root@squid 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,-sdefault,-hcritbit
Debug: Child (27715) Started
[root@squid varnish-cache]#

Step5:查看日志

[root@squid 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

[root@squid varnish-cache]# /usr/local/bin/varnishstat

标签:varnish,squid,ReqHeader,cache,代理服务器,反向,10.10,root
来源: https://www.cnblogs.com/networking/p/11628637.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有