无法获得清漆以查看后端

时间:2018-04-22 10:00:52

标签: varnish varnish-vcl

我在OSX上本地安装了Varnish来测试它。我有一个在localhost上运行的工作后端:8085返回200.我用Brew安装了清漆,但没有运行Brew服务,而是用

运行Varnish
varnishd -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

并在vcl_boot.*

中创建/usr/local/var/varnish文件夹

当我转到127.0.0.1:8090时,我看到清漆正在运行但只是

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.
}

有谁知道我可能缺少什么?

谢谢!

1 个答案:

答案 0 :(得分:1)

在您运行Varnish的命令中,我认为您错误地使用了a b a a a b a a b b 开关适用于:

  

在指定的地址和端口上提供管理界面。

因此,您将Varnish管理界面绑定到与后端相同的端口。不知道为什么不会失败。