【发布时间】:2018-03-01 17:20:10
【问题描述】:
我刚刚在我的开发服务器上安装了 varnish,它在没有更改任何配置的情况下运行。所以现在它只是向 Apache 询问响应并将其传回。
嗯,我是一个新手,我正在尝试缓存 javascript、css 和图像来测试清漆。我的问题是,如果我写返回(查找);在 vcl_recv 中给我服务清漆重启错误!
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "80";
}
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 request, etc.
#hash_data(req.url);
#if (req.http.host) {
# hash_data(req.http.host);
#} else {
# hash_data(server.ip);
#}
return (lookup);
}
sub vcl_backend_response {
# Happens after we have read the response headers from the backend.
#
# Here you clean the response headers, removing silly Set-Cookie headers
# and other mistakes your backend does.
}
sub vcl_deliver {
# Happens when we have all the pieces we need, and are about to send the
# response to the client.
#
# You can do accounting or modifying the final object here.
}
default.vcl 中的这个配置在重启时给了我下一个错误:
Job for varnish.service failed. See 'systemctl status varnish.service' and 'journalctl -xn' for details.
请帮帮我!!
【问题讨论】:
标签: varnish varnish-vcl varnish-4