亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
最近訪問(wèn)板塊 發(fā)新帖
查看: 1943 | 回復(fù): 0
打印 上一主題 下一主題

[服務(wù)應(yīng)用] Varnish 3.0.0/3.0.2反向代理+NginX出現(xiàn)奇怪現(xiàn)象 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2013-02-16 16:11 |只看該作者 |倒序?yàn)g覽
本帖最后由 小黑別被黑 于 2013-02-16 16:17 編輯

首先說(shuō)明一下,使用虛擬機(jī)安裝centos 6 64位
Varnish版本3.0.0/3.0.2  Nginx版本1.0.6
Varnish:172.2.2.108
Nginx:172.2.2.109

本地PC hosts文件中已經(jīng)設(shè)置:
172.2.2.108  www.t1.com(通過(guò)varnish訪問(wèn))
172.2.2.109  www.t2.com(通過(guò)nginx訪問(wèn))

varnish啟動(dòng)后,通過(guò)nginx訪問(wèn)
在瀏覽器中輸入www.t2.com,可正常訪問(wèn)

通過(guò)varnish訪問(wèn)時(shí):
在瀏覽器中輸入www.t1.com,會(huì)出現(xiàn)問(wèn)題,問(wèn)題是:第一次訪問(wèn)的時(shí)一直在load,始終打不開一直load,如果點(diǎn)下刷新就立刻顯示頁(yè)面,但是當(dāng)你再次訪問(wèn)的時(shí)候又出現(xiàn)第一次打開時(shí)的情況,再一刷新立刻又可以了!

各位大神都遇到過(guò)這個(gè)問(wèn)題嗎?換了2.0.x的版本任然有這個(gè)問(wèn)題

下面是我的vcl配置:
backend t1 {
        .host = "172.2.2.109";
        .port = "80";
        
}

#
# Below is a commented-out copy of the default VCL logic.  If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
sub vcl_recv {

     
     if (req.request == "GET" && req.url ~ "\.(jpg|png|gif|swf|flv|ico|jpeg)$") {
        unset req.http.cookie;
     }
     if (req.request =="GET"&&req.url ~ "(?i)\.php($|\?)"){
        return (pass);
     }
     if (req.restarts == 0) {
        if (req.http.x-forwarded-for) {
            set req.http.X-Forwarded-For =
                req.http.X-Forwarded-For + ", " + client.ip;
        } else {
            set req.http.X-Forwarded-For = client.ip;
        }
     }
     if (req.request != "GET" &&
       req.request != "HEAD" &&
       req.request != "PUT" &&
       req.request != "POST" &&
       req.request != "TRACE" &&
       req.request != "OPTIONS" &&
       req.request != "DELETE") {
         /* Non-RFC2616 or CONNECT which is weird. */
         return (pipe);
     }
     if (req.request != "GET" && req.request != "HEAD") {
         return (pass);
     }
     if (req.http.Authorization || req.http.Cookie) {
         return (pass);
     }
     if (req.http.host ~ "(?i)(www.t1.com)") {
               set req.backend = t1;
               set req.http.host = "www.t1.com";
               if (req.request != "GET" && req.request != "HEAD") {
                       return(pipe);
               }
       }
     return (lookup);
}

sub vcl_pipe {
    return (pipe);
}
sub vcl_pass {
     return (pass);
}
sub vcl_hash {
     hash_data(req.url);
     if (req.http.host) {
         hash_data(req.http.host);
     } else {
         hash_data(server.ip);
     }
     return (hash);
}
#
sub vcl_hit {
     if (req.request == "PURGE") {
        purge;
        error 200 "purged";
     }
     return (deliver);
}
#
sub vcl_miss {
     if(req.request == "PURGE") {
        error 404 "not in cache.";
     }
     return (fetch);
}
#
sub vcl_fetch {
     if (beresp.ttl <= 0s ||
         beresp.http.Set-Cookie ||
         beresp.http.Vary == "*") {
                /*
                 * Mark as "Hit-For-Pass" for the next 2 minutes
                 */
                set beresp.ttl = 120 s;
                return (hit_for_pass);
     }
     if (beresp.http.Pragma ~ "no-cache" ||
        beresp.http.Cache-Control ~ "no-cache" ||
        beresp.http.Cache-Control ~ "private") {
        return(deliver);
     }
     if(beresp.status == 404 || beresp.status == 300) {
        error 404;
     }
     if (req.request == "GET" && req.url ~ "\.(jpg|png|gif|swf|flv|ico|jpeg)$") {
        set beresp.ttl = 1d;
     }
     if (req.request == "GET" && req.url ~ "\.(htm|html)$") {
        set beresp.ttl = 1d;
     }
#       if (req.url ~ "\.(png|gif|jpg)$") {
#               unset beresp.http.set-cookie;
#               set beresp.ttl = 1h;
#       }
     return (deliver);
}
#
sub vcl_deliver {
        if (obj.hits > 0) {
                set resp.http.X-Cache = "cached";
        } else {
                set resp.http.x-Cache = "uncached";
        }
        unset resp.http.X-Powered-By;
        unset resp.http.Server;
        return (deliver);
}

sub vcl_error {
     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
     synthetic {"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
   <head>
     <title>"} + obj.status + " " + obj.response + {"</title>
   </head>
   <body>
     <h1>Error "} + obj.status + " " + obj.response + {"</h1>
     <p>"} + obj.response + {"</p>
     <h3>Guru Meditation:</h3>
     <p>XID: "} + req.xid + {"</p>
     <hr>
     <p>Varnish cache server</p>
   </body>
</html>
"};
     return (deliver);
}

sub vcl_init {
        return (ok);
}

sub vcl_fini {
        return (ok);
}

綜合飛鴻無(wú)痕與CyaLiven提出的問(wèn)題繼續(xù)請(qǐng)教,在線等
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP