varnish 的配置文件详细解析(VCL详解).doc

varnish 的配置文件详细解析(VCL详解).doc

  1. 1、本文档共7页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
varnish 的配置文件详细解析(VCL详解)

varnish的VCL的详细解析: 主机配置 backend www { .host = ; .port = http; .connect_timeout = 1s; 连接时间 .first_byte_timeout = 5s; 连接上后等待接受第一个字节的时间 .between_bytes_timeout = 2s; 在字节与字节之间的等待时间 } 多个主机实现负载均衡。 director b2 random { .retries = 5; { .backend = b1; .weight = 7; } { .backend = { .host = fs2; } .weight = 3; } } The random director(随即) The round-robin director(轮询) The client director 根据客户端(session cookie等)确认访问哪台服务器 The hash director(基于hash表来决定访问哪台服务器) The DNS director director directorname dns { .list = { .host_header = ; .port = 80; .connect_timeout = 0.4; /24; 28/25; } .ttl = 5m; 查找缓存时间 .suffix = ; 主机名后缀 } 健康检查 backend www { .host = ; .port = http; .probe = { .url = /test.jpg; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; } } Or it can be defined separately and then referenced:: probe healthcheck { .url = /status.cgi; .interval = 60s; .timeout = 0.3 s; .window = 8; .threshold = 3; .initial = 3; } backend www { .host = ; .port = http; .probe = healthcheck; } If you have many backends this can simplify the config a lot. It is also possible to specify the raw HTTP request: probe rawprobe { # NB: \r\n automatically inserted after each string! .request = GET / HTTP/1.1 Host: www.foo.bar Connection: close; } An ACL declaration creates and initializes a named access control list which can later be used to match client addresses:: acl local { localhost; // myself /24; // and everyone on the local network ! 3; // except for the dialin router } if (client.ip ~ local) { return (pipe); } 函数形式 sub pipe_if_local { if (client.ip ~ local) { return (pipe); } } Subroutines in VCL do not take arguments, nor do they return values. 函数调用: call pipe_if_local; 内置函数: vcl_recv在请求开始的时候调用,判断是否处理该请求,怎样处理以及访问后台哪个

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档