Chinaunix首页 | 论坛 | 博客
  • 博客访问: 111723
  • 博文数量: 25
  • 博客积分: 1094
  • 博客等级: 少尉
  • 技术积分: 284
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 16:36
文章分类

全部博文(25)

文章存档

2011年(14)

2010年(11)

分类: LINUX

2010-03-09 16:24:01

backend myblogserver {
       set backend.host = "192.168.1.103";
       set backend.port = "8282";
}
 
acl purge {
       "localhost";
       "127.0.0.1";
       "192.168.1.0"/24;
}
 
sub vcl_recv {
       if (req.request == "PURGE") {
               if (!client.ip ~ purge) {
                       error 405 "Not allowed.";
               }
               lookup;
       }
 
       if (req.http.host ~ "^") {
               set req.backend = myblogserver;
               if (req.request != "GET" && req.request != "HEAD") {
                       pipe;
               }
      elseif(req.url ~ "\.(php|cgi|jsp|do)($|\?)") {
                       pass;
      }
               else {
                       lookup;
               }
       }
       else {
               error 404 "Zhang Yan Cache Server";
               lookup;
       }
}
 
sub vcl_hit {
       if (req.request == "PURGE") {
               set obj.ttl = 0s;
               error 200 "Purged.";
       }
}
 
sub vcl_miss {
       if (req.request == "PURGE") {
               error 404 "Not in cache.";
       }
}
 
sub vcl_fetch {
       if (req.request == "GET" && req.url ~ "\.(txt|js)$") {
               set obj.ttl = 3600s;
       }
       else {
               set obj.ttl = 30d;
       }
}
阅读(1493) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~