我是 Varnish 的新手,我在 Debian Wheezy 上运行 v4.0。
我想在 4 周的缓存中设置默认 TTL(非常静态的内容)。
通过阅读文档,我认为答案是default_ttl在我的 VCL 文件中的某处设置一个选项。我搜索了文档,但只能找到一个参考。
我发现了这个问题,但我认为答案一定是过时的,因为它对我不起作用。
有人可以澄清如何在 Varnish 4.0 中做到这一点吗?
更新:这是我的配置文件(Varnish 4.0 附带的默认文件,除了我将后端指向本地主机):
backend default {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_backend_fetch {
set obj.ttl = 4w;
}
sub vcl_recv {
# Happens before we check if we have this in cache already.
#
# Typically you clean up the request here, removing cookies you don't need,
# rewriting the …Run Code Online (Sandbox Code Playgroud) varnish ×1