V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  RiESA  ›  全部回复第 23 页 / 共 60 页
回复总数  1186
1 ... 19  20  21  22  23  24  25  26  27  28 ... 60  
2020-03-24 17:11:23 +08:00
回复了 hooych 创建的主题 互联网 慎用 7 天无理由退货
京东自营>天猫>淘宝>京东第三方

狗东第三方真的是很辣鸡
2020-03-24 10:29:19 +08:00
回复了 RiESA 创建的主题 问与答 有没有什么工具方便的生成 app 的介绍图片的?
这种东西应该是叫 MockUp?
@sheeta hostdocuments 的缩写
2020-03-15 17:16:24 +08:00
回复了 Esioner 创建的主题 互联网 闲鱼的 PM 是猪吗?
不许你侮辱猪
2020-03-15 16:19:34 +08:00
回复了 zooo 创建的主题 新手求助 mac pro 开虚拟机打游戏对电脑有伤害吗?
只对果粉的信仰和逼格有伤害 (手动狗头)
2020-03-06 15:33:42 +08:00
回复了 RiESA 创建的主题 问与答 平常大家说的"百万 PV",是日均还是分钟实时?
@pango 我也想知道
2020-03-06 14:06:03 +08:00
回复了 RiESA 创建的主题 问与答 平常大家说的"百万 PV",是日均还是分钟实时?
@wd 那日均 PV 百万,而且稳定了一段时间都是这个数据的话,算什么规模的站呢, PV 和 UV 的比例大概 10:1
2020-03-06 11:42:38 +08:00
回复了 RiESA 创建的主题 问与答 平常大家说的"百万 PV",是日均还是分钟实时?
@fancy111 用得比较少是指现在 web 不景气吗? 还是有其他新的指标来观察一个网站的情况?
帖子标题违反广告法了
2020-02-23 18:52:21 +08:00
回复了 hxse 创建的主题 问与答 有没有一款支持 WYSIWYG(所见即所得)的跨平台 markdown 云笔记
马克飞象
下一个丸子工具箱自己压了再上传
2020-02-19 15:01:01 +08:00
回复了 turlin 创建的主题 生活 经过了这次 才知道指纹解锁还是香啊
两个一起用不好吗?
vcl 4.0;
# set default backend if no server cluster specified
backend default {
.host = "127.0.0.1";
.port = "80";
}
backend test {
.host = "127.0.0.1";
.port = "81";
}


# access control list for "purge": open to only localhost and other local nodes
acl purge {
"127.0.0.1";
}

# vcl_recv is called whenever a request is received
sub vcl_recv {
# Serve objects up to 2 minutes past their expiry if the backend
# is slow to respond.
# set req.grace = 120s;
if(req.http.host ~ "a.cn"){
set req.http.host = "a.cn";
set req.backend_hint = default;
}
if(req.http.host ~ "b.cn"){
set req.http.host = "b.cn";
set req.backend_hint = test;
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
set req.backend_hint= default;

# This uses the ACL action called "purge". Basically if a request to
# PURGE the cache comes from anywhere other than localhost, ignore it.
if (req.method == "PURGE") {
if (!client.ip ~ purge) {
return (synth(405, "Not allowed."));
} else {
return (purge);
}
}

# Pass any requests that Varnish does not understand straight to the backend.
if (req.method != "GET" && req.method != "HEAD" &&
req.method != "PUT" && req.method != "POST" &&
req.method != "TRACE" && req.method != "OPTIONS" &&
req.method != "DELETE") {
return (pipe);
} /* Non-RFC2616 or CONNECT which is weird. */

# Pass anything other than GET and HEAD directly.
if (req.method != "GET" && req.method != "HEAD") {
return (pass);
} /* We only deal with GET and HEAD by default */

# Pass requests from logged-in users directly.
# Only detect cookies with "session" and "Token" in file name, otherwise nothing get cached.
if (req.http.Authorization || req.http.Cookie ~ "session" || req.http.Cookie ~ "Token") {
return (pass);
} /* Not cacheable by default */

# normalize Accept-Encoding to reduce vary
if (req.http.Accept-Encoding) {
if (req.http.User-Agent ~ "MSIE 6") {
unset req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
unset req.http.Accept-Encoding;
}
}

return (hash);
}


sub vcl_pipe {
# Note that only the first request to the backend will have
# X-Forwarded-For set. If you use X-Forwarded-For and want to
# have it set for all requests, make sure to have:
# set req.http.connection = "close";

# This is otherwise not necessary if you do not do any request rewriting.

set req.http.connection = "close";
}

# Called if the cache has a copy of the page.
sub vcl_hit {
if (!obj.ttl > 0s) {
return (pass);
}

# Force lookup if the request is a no-cache request from the client.
if (req.http.Cache-Control ~ "no-cache") {
return (miss);
}
}

# Called after a document has been successfully retrieved from the backend.
sub vcl_backend_response {
# set minimum timeouts to auto-discard stored objects
set beresp.grace = 120s;

if (beresp.ttl < 48h) {
set beresp.ttl = 48h;
}

if (!beresp.ttl > 0s) {
set beresp.uncacheable = true;
return (deliver);
}

if (beresp.http.Set-Cookie) {
set beresp.uncacheable = true;
return (deliver);
}

# if (beresp.http.Cache-Control ~ "(private|no-cache|no-store)") {
# set beresp.uncacheable = true;
# return (deliver);
# }

if (beresp.http.Authorization && !beresp.http.Cache-Control ~ "public") {
set beresp.uncacheable = true;
return (deliver);
}

return (deliver);
}
更正一下,目前是下面这个才对,上面那个忘记改一个地方了
vcl 4.0;
# set default backend if no server cluster specified
backend default {
.host = "127.0.0.1";
.port = "80";
}
backend test {
.host = "127.0.0.1";
.port = "81";
}


# access control list for "purge": open to only localhost and other local nodes
acl purge {
"127.0.0.1";
}

# vcl_recv is called whenever a request is received
sub vcl_recv {
# Serve objects up to 2 minutes past their expiry if the backend
# is slow to respond.
# set req.grace = 120s;
if(req.http.host ~ "a.com"){
set req.http.host = "a.com";
set req.backend_hint = default;
}
if(req.http.host ~ "b.com"){
set req.http.host = "b.com";
set req.backend_hint = blog;
set req.http.X-Forwarded-For = req.http.X-Forwarded-For + ", " + client.ip;
set req.backend_hint= default;

# This uses the ACL action called "purge". Basically if a request to
# PURGE the cache comes from anywhere other than localhost, ignore it.
if (req.method == "PURGE") {
if (!client.ip ~ purge) {
return (synth(405, "Not allowed."));
} else {
return (purge);
}
}

# Pass any requests that Varnish does not understand straight to the backend.
if (req.method != "GET" && req.method != "HEAD" &&
req.method != "PUT" && req.method != "POST" &&
req.method != "TRACE" && req.method != "OPTIONS" &&
req.method != "DELETE") {
return (pipe);
} /* Non-RFC2616 or CONNECT which is weird. */

# Pass anything other than GET and HEAD directly.
if (req.method != "GET" && req.method != "HEAD") {
return (pass);
} /* We only deal with GET and HEAD by default */

# Pass requests from logged-in users directly.
# Only detect cookies with "session" and "Token" in file name, otherwise nothing get cached.
if (req.http.Authorization || req.http.Cookie ~ "session" || req.http.Cookie ~ "Token") {
return (pass);
} /* Not cacheable by default */

# normalize Accept-Encoding to reduce vary
if (req.http.Accept-Encoding) {
if (req.http.User-Agent ~ "MSIE 6") {
unset req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate") {
set req.http.Accept-Encoding = "deflate";
} else {
unset req.http.Accept-Encoding;
}
}

return (hash);
}


sub vcl_pipe {
# Note that only the first request to the backend will have
# X-Forwarded-For set. If you use X-Forwarded-For and want to
# have it set for all requests, make sure to have:
# set req.http.connection = "close";

# This is otherwise not necessary if you do not do any request rewriting.

set req.http.connection = "close";
}

# Called if the cache has a copy of the page.
sub vcl_hit {
if (!obj.ttl > 0s) {
return (pass);
}

# Force lookup if the request is a no-cache request from the client.
if (req.http.Cache-Control ~ "no-cache") {
return (miss);
}
}

# Called after a document has been successfully retrieved from the backend.
sub vcl_backend_response {
# set minimum timeouts to auto-discard stored objects
set beresp.grace = 120s;

if (beresp.ttl < 48h) {
set beresp.ttl = 48h;
}

if (!beresp.ttl > 0s) {
set beresp.uncacheable = true;
return (deliver);
}

if (beresp.http.Set-Cookie) {
set beresp.uncacheable = true;
return (deliver);
}

# if (beresp.http.Cache-Control ~ "(private|no-cache|no-store)") {
# set beresp.uncacheable = true;
# return (deliver);
# }

if (beresp.http.Authorization && !beresp.http.Cache-Control ~ "public") {
set beresp.uncacheable = true;
return (deliver);
}

return (deliver);
}
@sleepm 我又来请教您了,我昨晚尝试配置了一下多站点,但是出现了一个很奇怪的问题,站点 A,也就是第一个 backend 完全正常,第二个 backend,站点 B 会出现 404 的情况,但是又不是完全 404 强刷一下页面可以出来,但是没点几下又 404 这种,
目前的访问流程是:CDN>varnish>nginx,不排除是我设置写的有问题,不知道能不能帮我看看,谢谢
@sleepm 好的,谢谢
1 ... 19  20  21  22  23  24  25  26  27  28 ... 60  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2227 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 42ms · UTC 15:59 · PVG 23:59 · LAX 08:59 · JFK 11:59
Developed with CodeLauncher
♥ Do have faith in what you're doing.