{
  "version": "https://jsonfeed.org/version/1", 
  "title": "Varnish", 
  "description": "\u9ad8\u6027\u80fd\u7684 HTTP \u7f13\u5b58\u8f6f\u4ef6\uff0c\u53ef\u4ee5\u901a\u8fc7 VCL \u7075\u6d3b\u5b9a\u4e49\u89c4\u5219\u3002", 
  "home_page_url": "https://www.v2ex.com/go/varnish", 
  "feed_url": "https://www.v2ex.com/feed/varnish.json", 
  "icon": "https://cdn.v2ex.com/navatar/ffea/bd22/575_large.png?m=1402173598", 
  "favicon": "https://cdn.v2ex.com/navatar/ffea/bd22/575_normal.png?m=1402173598", 
  "items": [
    {
      "author": {
        "url": "https://www.v2ex.com/member/luger1990", 
        "name": "luger1990", 
        "avatar": "https://cdn.v2ex.com/gravatar/c0c714a703e4c28260b197428dfed8ad?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/461701", 
      "title": "varnish \u5982\u4f55\u6839\u636e header \u52a8\u6001\u8bbe\u7f6e\u7f13\u5b58\u65f6\u95f4", 
      "id": "https://www.v2ex.com/t/461701", 
      "date_published": "2018-06-09T04:09:37+00:00", 
      "content_html": "<p>\u53ef\u80fd\u6807\u9898\u95ee\u7684\u6709\u70b9\u6a21\u7cca\u3002\u5148\u8bf4\u8bf4\u73b0\u5728\u914d\u7f6e varnish \u5bf9\u67d0\u4e00\u4e2a url \u7f13\u5b58\u7684\u914d\u7f6e\u5427 \u662f\u8fd9\u6837\u7684\uff1a</p>\n<pre><code>if(bereq.url ~ \"/api/module/url\") {\n\tset beresp.ttl = 14400m; #\u5982\u679c\u8bf7\u6c42\u7684 url \u4e3a /api/module/url \u90a3\u4e48\u7f13\u5b58\u4e00\u5929\u65f6\u95f4\n}\n</code></pre>\n<p>\u4f46\u662f\u6211\u611f\u89c9\u8fd9\u4e48\u4e00\u4e2a\u4e2a url \u8bbe\u7f6e\u8d77\u6765\u592a\u9ebb\u70e6\u4e86\uff0c\u6211\u80fd\u4e0d\u80fd\u5728\u6211\u540e\u7aef\u4ee3\u7801\uff08 java)\u4e2d\u901a\u8fc7\u8bbe\u7f6e header \u6765\u52a8\u6001\u7684\u53bb\u914d\u7f6e\uff0c\u6bd4\u5982\u6211\u901a\u8fc7 response header \u8bbe\u7f6e</p>\n<pre><code>setHeader('varnishCache','true')\nsetHeader('varnishCacheTime','14400m')\n</code></pre>\n<p>\u90a3\u4e48\u6211 varnish \u7684\u4ee3\u7801\u8bbe\u7f6e\u5982\u4e0b\uff1a</p>\n<pre><code>if(beresp.http.varnishCache == \"true\"){ #\u6839\u636e header \u4e2d\u7684\u4fe1\u606f\u5224\u65ad\u662f\u5426\u7f13\u5b58\n\tset beresp.ttl = beresp.http.varnishCacheTime;#\u6839\u636e header \u4e2d\u7684\u65f6\u95f4\u8bbe\u7f6e\u7f13\u5b58\u65f6\u95f4\n}\n</code></pre>\n<p>\u4f46\u662f\u4e0a\u9762\u8fd9\u4e48\u914d\u7f6e reload varnish \u914d\u7f6e\u7684\u65f6\u5019\u4f1a\u62a5\u9519\u3002\u4e0d\u77e5\u9053\u80fd\u4e0d\u80fd\u5b9e\u73b0\u6211\u60f3\u7684\u914d\u7f6e</p>\n<p>\u65e2\u7136\u95ee\u4e86\u5c31\u591a\u95ee\u51e0\u4e2a\u95ee\u9898\u5427\uff0c\u54c8\u54c8\u54c8\u54c8\n\u95ee\u9898\u4e8c\uff1a\n\u5982\u679c\u6211\u8bbe\u7f6e\u4e00\u4e2a url \u7684\u7f13\u5b58\u65f6\u95f4\u4e3a 10s\uff0c\u90a3\u4e48 10 \u79d2\u5185\u90fd\u4e0d\u4f1a\u53d1\u8bf7\u6c42\u5230\u540e\u7aef\uff0c\u76f4\u63a5 varnish \u8fd4\u56de\u4e86\u3002\u4e07\u4e00\u7b2c 11 \u79d2\u7f13\u5b58\u5230\u671f\u4e86\uff0c\u6070\u6070\u6b64\u65f6\u6211\u540e\u7aef\u670d\u52a1\u5904\u95ee\u9898\u4e86\u8fd4\u56de\u4e86 503 \u6216\u8005\u8d85\u65f6\uff0c\u6211\u80fd\u4e0d\u80fd\u8fd8\u7ee7\u7eed\u7528\u7f13\u5b58\u4e2d\u7684\u6570\u636e\uff0c\u907f\u514d\u8fd4\u56de 503 \u6216\u8005 timeout\u3002</p>\n<p>\u5e0c\u671b\u5404\u4f4d\u5927\u795e\u6307\u6559</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1776858751"
      }, 
      "url": "https://www.v2ex.com/t/315059", 
      "title": "Varnish Explained", 
      "id": "https://www.v2ex.com/t/315059", 
      "date_published": "2016-10-24T08:23:57+00:00", 
      "content_html": "\u4e00\u7bc7\u5173\u4e8e Varnish \u7684\u5f88\u4e0d\u9519\u7684\u5165\u95e8\u4ecb\u7ecd\uff1a\r<br />\r<br /><a target=\"_blank\" href=\"https://ma.ttias.be/varnish-explained/\" rel=\"nofollow\">https://ma.ttias.be/varnish-explained/</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/baskice", 
        "name": "baskice", 
        "avatar": "https://cdn.v2ex.com/gravatar/fb609a0e3fee76a23eeb3209b39b7c22?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/313960", 
      "title": "varnish 4.1 \u548c 5.0 \u73b0\u5728\uff08 2016 \u5e74 10 \u6708 19 \u65e5\uff09\u6ee1\u6ee1\u7684\u90fd\u662f\u5751\u522b\u7528", 
      "id": "https://www.v2ex.com/t/313960", 
      "date_published": "2016-10-19T12:02:09+00:00", 
      "content_html": "\u5404\u79cd\u5c0f\u95ee\u9898\u4e0d\u65ad\uff0c\u6700\u8ba8\u538c\u7684\u662f 4.1 \u5ba3\u79f0 PROXY protocol support \uff0c\u4f46\u5b9e\u9645\u4e0a\u53ea\u8981\u6211\u5728 varnishd \u8fd0\u884c\u6761\u4ef6\u91cc\u4e00\u52a0\u4e0a :80,PROXY\r<br />\r<br />\u8bbf\u95ee\u5c31\u4f1a\u51fa\u73b0 empty response \u3002\u86cb\u75bc\u7684\u662f\u8fd9\u4e2a\u5b8c\u5168\u6ca1\u6709\u4efb\u4f55\u8bf7\u6c42\uff0c\u5bfc\u81f4\u770b log \u90fd\u6ca1\u6cd5 debug \uff0c\u56e0\u4e3a\u6ca1\u6709 log \u3002\u914d\u7f6e\u4e5f\u6ca1\u62a5\u9519\u3002\r<br />\r<br />\u6211\u4ece 3.0 \u5f00\u59cb\u4e00\u8def\u7528\u5230 5.0 \u3002 varnish \u8d8a\u505a\u8d8a\u5dee\u4e86\uff0c\u5927\u5bb6\u8fd8\u662f\u627e\u522b\u7684\u53cd\u5411\u4ee3\u7406\u7f13\u5b58\u8f6f\u4ef6\u5427"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/iCodex", 
        "name": "iCodex", 
        "avatar": "https://cdn.v2ex.com/avatar/2ff0/53bc/22128_large.png?m=1378618212"
      }, 
      "url": "https://www.v2ex.com/t/307538", 
      "title": "Varnish Cache 5.0", 
      "id": "https://www.v2ex.com/t/307538", 
      "date_published": "2016-09-20T06:56:59+00:00", 
      "content_html": "<a target=\"_blank\" href=\"https://varnish-cache.org/docs/5.0/whats-new/relnote-5.0.html\" rel=\"nofollow\">https://varnish-cache.org/docs/5.0/whats-new/relnote-5.0.html</a>\r<br />\r<br />\u65b0\u589e\u72ec\u7acb\u52a0\u8f7d vcl \u8fd9\u9879\u529f\u80fd\uff0c\u8fd9\u6837\u4e0d\u540c\u7684\u57df\u540d\u6216\u7c7b\u578b\u7684\u5e94\u7528\uff0c\u5c31\u53ef\u4ee5\u5355\u72ec\u52a0\u8f7d\u4e0d\u540c\u7684 vcl \u914d\u7f6e\uff0c\u907f\u514d\u4e86\u6df7\u4e71\u4e0d\u582a\u7684 vcl \u7ed3\u6784\uff0c\u770b\u5230\u5934\u70b8\u3002\r<br />\u8fd8\u6709\u9e21\u808b\u7684 http 2.0 \u7684\u652f\u6301\uff0c\u76f8\u4fe1\u540e\u9762\u7684\u7248\u672c\u4f1a\u5b8c\u5584\u597d\u8fd9\u9879"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/boro", 
        "name": "boro", 
        "avatar": "https://cdn.v2ex.com/avatar/9be7/9c01/55846_large.png?m=1433917021"
      }, 
      "url": "https://www.v2ex.com/t/193932", 
      "title": "\u542f\u7528\u7f13\u5b58\u540e\uff0c\u5927\u5bb6\u5982\u4f55\u89e3\u51b3\u7f51\u7ad9\u5373\u65f6\u663e\u793a\u65b0\u6dfb\u52a0\u6216\u4fee\u6539\u7684\u5185\u5bb9\uff1f", 
      "id": "https://www.v2ex.com/t/193932", 
      "date_published": "2015-05-26T12:57:10+00:00", 
      "content_html": "\u5982\u9898\uff0c\u6211\u76ee\u524d\u5728ngnix\uff0bwordpress\u6d4b\u8bd5\uff0c\u4e0d\u60f3\u7528\u63d2\u4ef6\u3002\u4e0d\u77e5\u9053\u5927\u5bb6\u5728\u7528\u4ec0\u4e48\u65b9\u6cd5\uff1f"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/boro", 
        "name": "boro", 
        "avatar": "https://cdn.v2ex.com/avatar/9be7/9c01/55846_large.png?m=1433917021"
      }, 
      "url": "https://www.v2ex.com/t/183478", 
      "title": "\u5927\u5bb6\u5e2e\u5fd9\u770b\u4e0b\u8fd9\u6bb5 Varnish \u7f13\u5b58\u89c4\u5219\u662f\u4ec0\u4e48\u539f\u56e0\u5bfc\u81f4\u7684\u8bed\u6cd5\u9519\u8bef", 
      "id": "https://www.v2ex.com/t/183478", 
      "date_published": "2015-04-13T11:26:33+00:00", 
      "content_html": "\u8bd5\u4e86\u4e0bVarnish\u5b98\u65b9\u7ed9\u51fa\u7684\u4e00\u4e2a\u7f13\u5b58\u5e94\u7528\u5b9e\u4f8b\uff0c\u7ed3\u679c\u5f97\u5230\u4e86\u4e0b\u9762\u8fd9\u4e2a\u9519\u8bef\uff1a<br />Message from VCC-compiler:<br /><br />Syntax error at<br /><br />('input' Line 29 Pos 17)<br /><br />   if (req.url ~ &quot;\\ (utm_ (campaign |? medium | source | term) | adParams | client | cx | eid | fbid | feed | ref (id | src) |? v (er | iew)) =&quot; ) {<br /><br />---------------- # --------------------------------- -------------------------------------------------- -------------------<br /><br />Running VCC-compiler failed, exit 1<br /><br />\u8fd9\u4e2a\u9519\u5728\u54ea\u5462\uff1f<br /><br />\u5168\u90e8\u7f13\u5b58\u89c4\u5219\u5982\u4e0b\uff1a<br /><br />backend default {<br />    .host = &quot;127.0.0.1&quot;;<br />    .port = &quot;8080&quot;;<br />}<br /><br />sub vcl_recv {<br />  if (req.http.Accept-Encoding) {<br />#revisit this list<br />    if (req.url ~ &quot;\\.(gif|jpg|jpeg|swf|flv|mp3|mp4|pdf|ico|png|gz|tgz|bz2)(\\?.*|)$&quot;) {<br />      remove req.http.Accept-Encoding;<br />    } elsif (req.http.Accept-Encoding ~ &quot;gzip&quot;) {<br />      set req.http.Accept-Encoding = &quot;gzip&quot;;<br />    } elsif (req.http.Accept-Encoding ~ &quot;deflate&quot;) {<br />      set req.http.Accept-Encoding = &quot;deflate&quot;;<br />    } else {<br />      remove req.http.Accept-Encoding;<br />    }<br />  }<br />  if (req.url ~ &quot;\\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\\?.*|)$&quot;) {<br />    unset req.http.cookie;<br />    set req.url = regsub(req.url, &quot;\\?.*$&quot;, &quot;&quot;);<br />  }<br />  if (req.url ~ \u201c\\?(utm_(campaign|medium|source|term)|adParams|client|cx|eid|fbid|feed|ref(id|src)?|v(er|iew))=\u201d) {<br />    set req.url = regsub(req.url, \u201c\\?.*$\u201d, \u201c\u201d);<br />  }<br />  if (req.http.cookie) {<br />    if (req.http.cookie ~ &quot;(wordpress_|wp-settings-)&quot;) {<br />      return(pass);<br />    } else {<br />      unset req.http.cookie;<br />    }<br />  }<br />}<br /><br />sub vcl_fetch {<br />  if (req.url ~ &quot;wp-(login|admin)&quot; || req.url ~ &quot;preview=true&quot; || req.url ~ &quot;xmlrpc.php&quot;) {<br />    return (hit_for_pass);<br />  }<br />  if ( (!(req.url ~ &quot;(wp-(login|admin)|login)&quot;)) || (req.request == &quot;GET&quot;) ) {<br />    unset beresp.http.set-cookie;<br />  }<br />  if (req.url ~ &quot;\\.(gif|jpg|jpeg|swf|css|js|flv|mp3|mp4|pdf|ico|png)(\\?.*|)$&quot;) {<br />    set beresp.ttl = 365d;<br />  }<br />}<br /><br />sub vcl_deliver {<br /># multi-server webfarm? set a variable here so you can check<br /># the headers to see which frontend served the request<br />#   set resp.http.X-Server = &quot;server-01&quot;;<br />   if (obj.hits &gt; 0) {<br />     set resp.http.X-Cache = &quot;HIT&quot;;<br />   } else {<br />     set resp.http.X-Cache = &quot;MISS&quot;;<br />   }<br />}"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1776858751"
      }, 
      "url": "https://www.v2ex.com/t/181012", 
      "title": "Fastly \u5199\u7684\u4ed6\u4eec\u4e3a\u4ec0\u4e48\u7528 Varnish \u505a CDN \u7684\u7406\u7531", 
      "id": "https://www.v2ex.com/t/181012", 
      "date_published": "2015-04-01T22:00:55+00:00", 
      "content_html": "<a target=\"_blank\" href=\"http://www.fastly.com/blog/benefits-of-using-varnish/\" rel=\"nofollow\">http://www.fastly.com/blog/benefits-of-using-varnish/</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1776858751"
      }, 
      "url": "https://www.v2ex.com/t/151886", 
      "title": "Varnish Massive Storage Engine", 
      "id": "https://www.v2ex.com/t/151886", 
      "date_published": "2014-12-05T23:40:10+00:00", 
      "content_html": "<a target=\"_blank\" href=\"https://www.varnish-software.com/blog/introducing-varnish-massive-storage-engine\" rel=\"nofollow\">https://www.varnish-software.com/blog/introducing-varnish-massive-storage-engine</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/loveminds", 
        "name": "loveminds", 
        "avatar": "https://cdn.v2ex.com/avatar/03bf/f917/20207_large.png?m=1406769878"
      }, 
      "url": "https://www.v2ex.com/t/132428", 
      "title": "Varnish/nginx \u53cd\u5411\u4ee3\u7406\u5982\u4f55\u89e3\u51b3\u540e\u7aef\u83b7\u53d6 server_addr \u662f 127.0.0.1 \u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/132428", 
      "date_published": "2014-09-09T04:33:00+00:00", 
      "content_html": "remote_addr\u6709\u5f88\u591a\u529e\u6cd5\u83b7\u53d6\uff0c\u4f46\u662f\u6211\u8981\u8bf4\u7684\u662fserver_addr"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/9", 
        "name": "9", 
        "avatar": "https://cdn.v2ex.com/avatar/e6a2/c4d3/21974_large.png?m=1341559517"
      }, 
      "url": "https://www.v2ex.com/t/121433", 
      "date_modified": "2014-07-07T23:12:12+00:00", 
      "content_html": "\u611f\u89c9\u653e\u5728 Nginx \u524d\u9762\u6216\u8005\u540e\u9762\u90fd\u884c\uff1f\u521a\u63a5\u89e6Varnish\uff0c\u5927\u795e\u6307\u5bfc\u4e0b", 
      "date_published": "2014-07-07T15:01:20+00:00", 
      "title": "Varnish \u4e00\u822c\u662f\u653e\u5728 Nginx \u524d\u9762\u8fd8\u662f\u540e\u9762\u7684\uff1f", 
      "id": "https://www.v2ex.com/t/121433"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/solar", 
        "name": "solar", 
        "avatar": "https://cdn.v2ex.com/avatar/2c27/a260/5006_large.png?m=1404705694"
      }, 
      "url": "https://www.v2ex.com/t/115058", 
      "date_modified": "2014-05-30T08:40:42+00:00", 
      "content_html": "varnish \u5df2\u5b89\u88c5\u5e76\u6b63\u786e\u8fd0\u884c\u3002<br /><a target=\"_blank\" href=\"http://ww3.sinaimg.cn/large/46e05ff1jw1egwctrtn0nj20za041gne.jpg\" target=\"_blank\"><img src=\"http://ww3.sinaimg.cn/large/46e05ff1jw1egwctrtn0nj20za041gne.jpg\" class=\"imgly\" style=\"max-width: 660px;\" border=\"0\" /></a><br /><br />\u6211\u5728web\u670d\u52a1\u5668\u76848383\u7aef\u53e3\u4e0a\u90e8\u7f72\u4e86\u4e00\u4e2a\u7f51\u7ad9\u3002\u73b0\u5728\u8981\u7528varnish\u4e3a\u5b83\u63d0\u4f9b\u7f13\u5b58\u670d\u52a1\u3002\u4e0d\u77e5\u9053\u600e\u4e48\u914d\u7f6e\u3002\u67e5\u4e86\u5f88\u591a\u8d44\u6599\uff0c\u4f46\u662f\u6211\u59cb\u7ec8\u6ca1\u80fd\u5728Headers\u91cc\u770b\u5230X-Varnish\u3002varnish\u548cweb\u670d\u52a1\u5728\u540c\u4e00\u53f0\u670d\u52a1\u5668\u4e0a\u3002<br /><br />/etc/varnish/default.vcl<br />&lt;pre&gt;<br /># This is a basic VCL configuration file for varnish.  See the vcl(7)<br /># man page for details on VCL syntax and semantics.<br /># <br /># Default backend definition.  Set this to point to your content<br /># server.<br />#<br />import std;<br /><br />probe healthchk {<br />    .url = \"/\";<br />    .interval = 3s;<br />    .timeout = 10ms;<br />    .window = 3;<br />    .threshold = 2;<br />    .initial = 3;<br />    .expected_response = 200;<br />}<br /><br />backend default {<br />    .host = \"xx.xx.xx.xx\";<br />    .port = \"8383\";<br />    .probe = healthchk;<br />}<br /><br />#acl purge {<br />#    \"localhost\";<br />#    \"127.0.0.1\";<br />#    \"xx.xx.xx.xx\"/24;<br />#}<br /><br /># <br /># Below is a commented-out copy of the default VCL logic.  If you<br /># redefine any of these subroutines, the built-in logic will be<br /># appended to your code.<br />sub vcl_recv {<br />    if (req.restarts == 0) {<br />    if (req.http.x-forwarded-for) {<br />        set req.http.X-Forwarded-For =<br />        req.http.X-Forwarded-For + \", \" + client.ip;<br />    } else {<br />        set req.http.X-Forwarded-For = client.ip;<br />    }<br />    }<br />    if (req.request != \"GET\" &&<br />      req.request != \"HEAD\" &&<br />      req.request != \"PUT\" &&<br />      req.request != \"POST\" &&<br />      req.request != \"TRACE\" &&<br />      req.request != \"OPTIONS\" &&<br />      req.request != \"DELETE\") {<br />        /* Non-RFC2616 or CONNECT which is weird. */<br />        return (pipe);<br />    }<br />    if (req.request != \"GET\" && req.request != \"HEAD\") {<br />        /* We only deal with GET and HEAD by default */<br />        return (pass);<br />    }<br />    if (req.http.Authorization || req.http.Cookie) {<br />        /* Not cacheable by default */<br />        return (pass);<br />    }<br />    return (lookup);<br />}<br /><br />sub vcl_pipe {<br />    # Note that only the first request to the backend will have<br />    # X-Forwarded-For set.  If you use X-Forwarded-For and want to<br />    # have it set for all requests, make sure to have:<br />    # set bereq.http.connection = \"close\";<br />    # here.  It is not set by default as it might break some broken web<br />    # applications, like IIS with NTLM authentication.<br />    return (pipe);<br />}<br /><br />sub vcl_pass {<br />    return (pass);<br />}<br /><br />sub vcl_hash {<br />    hash_data(req.url);<br />    if (req.http.host) {<br />        hash_data(req.http.host);<br />    } else {<br />        hash_data(server.ip);<br />    }<br />    return (hash);<br />}<br /><br />sub vcl_hit {<br />    return (deliver);<br />}<br /><br />sub vcl_miss {<br />    return (fetch);<br />}<br /><br />sub vcl_fetch {<br />    if (beresp.ttl &lt;= 0s ||<br />        beresp.http.Set-Cookie ||<br />        beresp.http.Vary == \"*\") {<br />        /*<br />         * Mark as \"Hit-For-Pass\" for the next 2 minutes<br />         */<br />        set beresp.ttl = 120 s;<br />        return (hit_for_pass);<br />    }<br />    return (deliver);<br />}<br /><br />sub vcl_deliver {<br />    return (deliver);<br />}<br /><br />sub vcl_error {<br />    set obj.http.Content-Type = \"text/html; charset=utf-8\";<br />    set obj.http.Retry-After = \"5\";<br />    synthetic {\"<br />&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;<br />&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"<br /> \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"&gt;<br />&lt;html&gt;<br />  &lt;head&gt;<br />    &lt;title&gt;\"} + obj.status + \" \" + obj.response + {\"&lt;/title&gt;<br />  &lt;/head&gt;<br />  &lt;body&gt;<br />    &lt;h1&gt;Error \"} + obj.status + \" \" + obj.response + {\"&lt;/h1&gt;<br />    &lt;p&gt;\"} + obj.response + {\"&lt;/p&gt;<br />    &lt;h3&gt;Guru Meditation:&lt;/h3&gt;<br />    &lt;p&gt;XID: \"} + req.xid + {\"&lt;/p&gt;<br />    &lt;hr&gt;<br />    &lt;p&gt;Varnish cache server&lt;/p&gt;<br />  &lt;/body&gt;<br />&lt;/html&gt;<br />\"};<br />    return (deliver);<br />}<br /><br />sub vcl_init {<br />    return (ok);<br />}<br /><br />sub vcl_fini {<br />    return (ok);<br />}<br />&lt;/pre&gt;<br />----------------------------------------------------------------------------<br />/etc/sysconfig/varnish<br />&lt;pre&gt;<br /># Configuration file for varnish<br />#<br /># /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this<br /># shell script fragment.<br />#<br /><br /># Maximum number of open files (for ulimit -n)<br />NFILES=131072<br /><br /># Locked shared memory (for ulimit -l)<br /># Default log size is 82MB + header<br />MEMLOCK=82000<br /><br /># Maximum number of threads (for ulimit -u)<br />NPROCS=\"unlimited\"<br /><br /># Maximum size of corefile (for ulimit -c). Default in Fedora is 0<br /># DAEMON_COREFILE_LIMIT=\"unlimited\"<br /><br /># Set this to 1 to make init script reload try to switch vcl without restart.<br /># To make this work, you need to set the following variables<br /># explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS,<br /># VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short,<br /># use Alternative 3, Advanced configuration, below<br />RELOAD_VCL=1<br /><br /># This file contains 4 alternatives, please use only one.<br /><br />## Alternative 1, Minimal configuration, no VCL<br />#<br /># Listen on port 6081, administration on localhost:6082, and forward to<br /># content server on localhost:8080.  Use a fixed-size cache file.<br />#<br />#DAEMON_OPTS=\"-a :6081 \\<br />#             -T localhost:6082 \\<br />#             -b localhost:8080 \\<br />#             -u varnish -g varnish \\<br />#             -s file,/var/lib/varnish/varnish_storage.bin,1G\"<br /><br /><br />## Alternative 2, Configuration with VCL<br />#<br /># Listen on port 6081, administration on localhost:6082, and forward to<br /># one content server selected by the vcl file, based on the request.  Use a<br /># fixed-size cache file.<br />#<br />#DAEMON_OPTS=\"-a :6081 \\<br />#             -T localhost:6082 \\<br />#             -f /etc/varnish/default.vcl \\<br />#             -u varnish -g varnish \\<br />#             -S /etc/varnish/secret \\<br />#             -s file,/var/lib/varnish/varnish_storage.bin,1G\"<br /><br /><br />## Alternative 3, Advanced configuration<br />#<br /># See varnishd(1) for more information.<br />#<br /># # Main configuration file. You probably want to change it :)<br />VARNISH_VCL_CONF=/etc/varnish/default.vcl<br />#<br /># # Default address and port to bind to<br /># # Blank address means all IPv4 and IPv6 interfaces, otherwise specify<br /># # a host name, an IPv4 dotted quad, or an IPv6 address in brackets.<br /># VARNISH_LISTEN_ADDRESS=<br />VARNISH_LISTEN_PORT=80<br />#<br /># # Telnet admin interface listen address and port<br />VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1<br />VARNISH_ADMIN_LISTEN_PORT=6082<br />#<br /># # Shared secret file for admin interface<br />VARNISH_SECRET_FILE=/etc/varnish/secret<br />#<br /># # The minimum number of worker threads to start<br />VARNISH_MIN_THREADS=50<br />#<br /># # The Maximum number of worker threads to start<br />VARNISH_MAX_THREADS=1000<br />#<br /># # Idle timeout for worker threads<br />VARNISH_THREAD_TIMEOUT=120<br />#<br /># # Cache file location<br />VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin<br />#<br /># # Cache file size: in bytes, optionally using k / M / G / T suffix,<br /># # or in percentage of available disk space using the % suffix.<br />VARNISH_STORAGE_SIZE=1G<br />#<br /># # Backend storage specification<br />VARNISH_STORAGE=\"file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}\"<br />#<br /># # Default TTL used when the backend does not specify one<br />VARNISH_TTL=120<br />#<br /># # DAEMON_OPTS is used by the init script.  If you add or remove options, make<br /># # sure you update this section, too.<br />DAEMON_OPTS=\"-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \\<br />             -f ${VARNISH_VCL_CONF} \\<br />             -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \\<br />             -t ${VARNISH_TTL} \\<br />             -w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \\<br />             -u varnish -g varnish \\<br />             -S ${VARNISH_SECRET_FILE} \\<br />             -s ${VARNISH_STORAGE}\"<br />#<br /><br /><br />## Alternative 4, Do It Yourself. See varnishd(1) for more information.<br />#<br /># DAEMON_OPTS=\"\"<br />&lt;/pre&gt;", 
      "date_published": "2014-05-30T08:07:55+00:00", 
      "title": "\u6c42\u52a9\uff1a\u5173\u4e8e varnish \u914d\u7f6e\u7684\u95ee\u9898", 
      "id": "https://www.v2ex.com/t/115058"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1776858751"
      }, 
      "url": "https://www.v2ex.com/t/112441", 
      "title": "VML", 
      "id": "https://www.v2ex.com/t/112441", 
      "date_published": "2014-05-13T22:27:05+00:00", 
      "content_html": "<a target=\"_blank\" href=\"http://phk.freebsd.dk/VML/index.html\" rel=\"nofollow\">http://phk.freebsd.dk/VML/index.html</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1776858751"
      }, 
      "url": "https://www.v2ex.com/t/112439", 
      "title": "Varnish Cache 4.0.0", 
      "id": "https://www.v2ex.com/t/112439", 
      "date_published": "2014-05-13T21:42:18+00:00", 
      "content_html": "<a target=\"_blank\" href=\"https://www.varnish-cache.org/content/varnish-cache-400\" rel=\"nofollow\">https://www.varnish-cache.org/content/varnish-cache-400</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/kingwkb", 
        "name": "kingwkb", 
        "avatar": "https://cdn.v2ex.com/gravatar/20643dccfaec689202f912384fa4d985?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/93359", 
      "title": "varnish\u53ef\u4ee5\u8d70ssl\u5417", 
      "id": "https://www.v2ex.com/t/93359", 
      "date_published": "2013-12-16T07:43:54+00:00", 
      "content_html": "\u5ba2\u6237\u7aefssl -&gt; varnish -&gt; nginx<br /><br />varnish \u548cnginx\u4e0a\u9762\u90fd\u8d70ssl"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/h2sky", 
        "name": "h2sky", 
        "avatar": "https://cdn.v2ex.com/avatar/bb8b/f48a/23582_large.png?m=1342504767"
      }, 
      "url": "https://www.v2ex.com/t/92714", 
      "date_modified": "2013-12-11T06:55:36+00:00", 
      "content_html": "&lt;?php<br />echo rand(1,99);<br />?&gt;<br /><br />\u8f93\u51fa\u7684\u662f43\uff0c\u4e4b\u540e\u8f93\u51fa\u7684\u8fd8\u662f43\uff0c\u9700\u8981\u8fc71\u5206\u949f\u5de6\u53f3\u518d\u66f4\u65b0<br /><br />\u600e\u4e48\u529e\uff1f", 
      "date_published": "2013-12-11T06:54:36+00:00", 
      "title": "\u600e\u4e48\u5904\u7406Varnish \u52a8\u6001\u8f93\u51fa\uff1f", 
      "id": "https://www.v2ex.com/t/92714"
    }
  ]
}