【发布时间】:2018-10-02 12:45:52
【问题描述】:
我在 OSX 上本地安装了 Varnish 来测试它。我有一个在 localhost:8085 上运行的工作后端,它返回 200。我使用 Brew 安装了 varnish,但没有运行 Brew 服务,而是使用
运行 Varnishvarnishd -n /usr/local/var/varnish -f /usr/local/etc/varnish/default.vcl -T 127.0.0.1:8085 -a 127.0.0.1:8090 -F
打印出来的
Debug: Platform: Darwin,17.5.0,x86_64,-jnone,-sdefault,-sdefault,-hcritbit
Debug: Child (57659) Started
Info: Child (57659) said Child starts
并在/usr/local/var/varnish 中创建一个vcl_boot.* 文件夹
当我转到 127.0.0.1:8090 时,我看到 varnish 正在运行,但只是得到
Error 503 Backend fetch failed
Backend fetch failed
我的/usr/local/etc/varnish/default.vcl 几乎是默认值:
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;
# Default backend definition. Set this to point to your content server.
backend default {
.host = "127.0.0.1";
.port = "8085";
}
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.
}
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.
}
有人知道我可能会错过什么吗?
谢谢!
【问题讨论】:
标签: varnish varnish-vcl