- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的服务器上的 80 端口安装了 varnish 缓存,Apache 作为 8080 端口上的内容服务器。如果我运行 wget --mirror example.com,它应该遍历我的整个网站并创建 varnish 缓存,对吗?它不是。例如,通过运行 wget --mirror example.com 我可以在我的输出中看到它已经通过 example.com/abc.html 运行。但是当我从浏览器访问 example.com/abc.html 时,从我的响应头中我可以看到它正在返回 Varnish MISS(并且它也需要很长时间)。但是,如果我这次通过浏览器再次访问相同的 url,则缓存已生成,因为我可以在响应 header 中看到 Varnish HIT
这是另一个有趣的事实:如果我只运行 wget example.com/abc.html 它将创建 Varnish 缓存!另一个有趣的事实:如果我运行 wget --mirror example.com/abc.html 它将为 abc.html 创建 Varnish 缓存,但不会为其他页面创建
因此,出于某种原因,使用 --mirror example.com 为第一页创建 Varnish 缓存,但不会为下一页创建。
如果有任何不同,我正在使用 Magento
我试过了:
wget --mirror --no-http-keep-alive example.com
但它不起作用
这是我的 Varnish vcl
# This is a basic VCL configuration file for PageCache powered by Varnish for Magento module.
# default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8080";
}
# admin backend with longer timeout values. Set this to the same IP & port as your default server.
backend admin {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 18000s;
.between_bytes_timeout = 18000s;
}
# add your Magento server IP to allow purges from the backend
acl purge {
"localhost";
"127.0.0.1";
}
sub vcl_recv {
if (client.ip ~ purge) {
set req.hash_always_miss = true;
}
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" &&
req.request != "PURGE") {
/* Non-RFC2616 or CONNECT which is weird. */
return (pipe);
}
# purge request
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
ban("obj.http.X-Purge-Host ~ " + req.http.X-Purge-Host + " && obj.http.X-Purge-URL ~ " + req.http.X-Purge-Regex + " && obj.http.Content-Type ~ " + req.http.X-Purge-Content-Type);
error 200 "Purged.";
}
# switch to admin backend configuration
if (req.http.cookie ~ "adminhtml=") {
set req.backend = admin;
}
# we only deal with GET and HEAD by default
if (req.request != "GET" && req.request != "HEAD") {
return (pass);
}
# normalize url in case of leading HTTP scheme and domain
set req.url = regsub(req.url, "^http[s]?://[^/]+", "");
# static files are always cacheable. remove SSL flag and cookie
if (req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$") {
unset req.http.Https;
unset req.http.Cookie;
}
# not cacheable by default
if (req.http.Authorization || req.http.Https) {
return (pass);
}
# do not cache any page from
# - index files
# - ...
if (req.url ~ "^/(index)") {
return (pass);
}
# as soon as we have a NO_CACHE cookie pass request
if (req.http.cookie ~ "NO_CACHE=") {
return (pass);
}
# normalize Aceept-Encoding header
# http://varnish.projects.linpro.no/wiki/FAQ/Compression
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
# No point in compressing these
remove req.http.Accept-Encoding;
} elsif (req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif (req.http.Accept-Encoding ~ "deflate" && req.http.user-agent !~ "MSIE") {
set req.http.Accept-Encoding = "deflate";
} else {
# unkown algorithm
remove req.http.Accept-Encoding;
}
}
# remove Google gclid parameters
set req.url = regsuball(req.url,"\?gclid=[^&]+$",""); # strips when QS = "?gclid=AAA"
set req.url = regsuball(req.url,"\?gclid=[^&]+&","?"); # strips when QS = "?gclid=AAA&foo=bar"
set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
return (lookup);
}
# 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 bereq.http.connection = "close";
# # here. It is not set by default as it might break some broken web
# # applications, like IIS with NTLM authentication.
# 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);
}
if (!(req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$")) {
call design_exception;
}
return (hash);
}
#
# sub vcl_hit {
# return (deliver);
# }
#
# sub vcl_miss {
# return (fetch);
# }
sub vcl_fetch {
if (beresp.status == 500) {
set beresp.saintmode = 10s;
return (restart);
}
set beresp.grace = 5m;
# add ban-lurker tags to object
set beresp.http.X-Purge-URL = req.url;
set beresp.http.X-Purge-Host = req.http.host;
if (beresp.status == 200 || beresp.status == 301 || beresp.status == 404) {
if (beresp.http.Content-Type ~ "text/html" || beresp.http.Content-Type ~ "text/xml") {
if ((beresp.http.Set-Cookie ~ "NO_CACHE=") || (beresp.ttl < 1s)) {
set beresp.ttl = 0s;
return (hit_for_pass);
}
# marker for vcl_deliver to reset Age:
set beresp.http.magicmarker = "1";
# Don't cache cookies
unset beresp.http.set-cookie;
} else {
# set default TTL value for static content
set beresp.ttl = 4h;
}
return (deliver);
}
return (hit_for_pass);
}
sub vcl_deliver {
# debug info
if (resp.http.X-Cache-Debug) {
if (obj.hits > 0) {
set resp.http.X-Cache = "HIT";
set resp.http.X-Cache-Hits = obj.hits;
} else {
set resp.http.X-Cache = "MISS";
}
set resp.http.X-Cache-Expires = resp.http.Expires;
} else {
# remove Varnish/proxy header
remove resp.http.X-Varnish;
remove resp.http.Via;
remove resp.http.Age;
remove resp.http.X-Purge-URL;
remove resp.http.X-Purge-Host;
}
if (resp.http.magicmarker) {
# Remove the magic marker
unset resp.http.magicmarker;
set resp.http.Cache-Control = "no-store, no-cache, must-revalidate, post-check=0, pre-check=0";
set resp.http.Pragma = "no-cache";
set resp.http.Expires = "Mon, 31 Mar 2008 10:00:00 GMT";
set resp.http.Age = "0";
}
}
# 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);
# }
sub design_exception {
}
wget --spider --recursive --no-cookies --header "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" --header "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3" --header "Accept-Language: en-US,en;q=0.8" --header "Cache-Control: max-age=0" --header "Connection: keep-alive" --header "Host: www.example.com" --header "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.19 (KHTML, like Gecko) Ubuntu/10.04 Chromium/18.0.1025.168 Chrome/18.0.1025.168 Safari/535.19" www.example.com
最佳答案
你应该看两点:
Accept-Encoding ~ 'gzip'
header ,因此如果您的蜘蛛不使用该条目,则不会使用缓存条目(生成 gzip 响应的体面后端会添加一个变量:Accept-Encoding
header )。 关于magento - wget --mirror 不创建 Varnish 缓存,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13195613/
我正在尝试向上施法Map至 Map . Actor 工作是有意义的,因为 Field and Value extend Mirror , 但是我得到一个 "cannot cast" error . 是
可以使用encoded polylines至render maps on timeline cards ?如果不是,坐标计数的实际限制是多少? 最佳答案 当前实现尚不支持编码折线。请随时通过我们的 i
我和我想象的其他人一样,每天有 1000 次 Mirror API 调用的礼貌限制。 我看到有一个看起来很有前途的批处理工具,但它似乎只能批处理对单个凭据的请求。因此,即使是一位客户,每 60 秒向
有没有办法以编程方式获取 Explorer 开发者帐户的 Mirror API 使用情况? 当 403 错误即将发生时,我希望更优雅地降级服务。 谢谢! 如果任何探索者能够幸运地计算自己的使用情况并发
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 9
虽然可以将图像发送到时间线卡中的玻璃,但看起来不能相反(拍照并上传)。 如果我是正确的,此操作将作为镜像 API(如 SHARE、REPLY、NAVIGATE)中的用户操作执行,但我没有看到任何与相机
.yaml 文件如下: dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 fluttertoast: ^2.0
我必须将几个 repos 从 Gitlab move 到 Bitbucket 并发现最简单的方法似乎是: 在 Bitbucket 中创建新的空存储库 git clone --mirror git@gi
有人知道什么可能导致主题错误吗?我发现了另一个帖子 Enunciate Issue = Assembling the enunciate app. com.sun.tools.apt.mirror.t
我需要获得一个角度的补充。 正是我需要做的是实现某种镜像角度的代码,比方说,我有 45 度 -> 135,另一个例子:80 -> 100,0 度 -> 180,等等。 最佳答案 我认为你在追求 180
所以我已经断断续续地工作了一个星期,谷歌搜索等等,我还没有找到如何做到这一点。 我有一张“光线”表和一张“线”表,我希望这些线充当镜子,并在光线碰到一条线时反射光线。想象一下激光从镜子上反弹,那种反射
为开发镜像生产环境数据的好方法是什么?我们有一台生产服务器,它安装了许多 smb 共享,几个脚本经常针对这些共享运行。 我们现在有一个单独的开发服务器,我们希望将其分开进行测试。如何在不复制所有这些
前言 Mirror是Swift中的反射机制,对于C#和Java开发人员来说,应该很熟悉反射这个概念。反射就是可以动态的获取类型以及成员信息,同时也可以在运行时动态的调用方法和
由于国内特殊的网络环境,往往我们从Docker Hub中拉取镜像并不能成功,而且速度特别慢。 那么我们可以给docker配置一个国内的registry mirror,当我们需要的镜像在mirror
除了 DEFAULT 之外还有其他选择吗?对于通知级别? timelineItem.setNotification(new NotificationConfig().setLevel("DEFAULT
我有一个 Maven 镜像存储库(Archiva) 例如 archiva * http://myMirrorHost
我试图简单地删除一些由我的应用程序创建的卡片。但是,似乎 list() 方法循环遍历了整个用户时间轴中的每张卡片。 我下面的代码是根据时间线列表下的文档中的示例稍作修改的。当我尝试使用它时,它不小心循
我正在运行 vagrant box “puphpet/centos65-x64”。 我按照这里的说明进行操作:https://wiki.jenkins-ci.org/display/JENKINS/I
就我而言,Glassware 使用“记笔记”语音命令插入 jpeg 图像作为时间线卡,作为对用户语音查询的响应。有时我会等待 10-15 分钟,然后才能在 Glass 上看到时间线卡。有时,我只有在重
当我有一个带有 REPLY Action 的包(也许这也发生在单个时间线卡上)并且用户执行该 Action 时,比如“花生酱和果冻三明治”,一个新的时间线卡会出现在黑色背景上,带有白色文本在玻璃上,上
我是一名优秀的程序员,十分优秀!