Reputation: 17894
I installed Varnish locally on OSX to test it out. I have a working backend running on localhost:8085 that returns a 200. I installed varnish with Brew but don't have the Brew service running, I instead run Varnish with
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
which prints
Debug: Platform: Darwin,17.5.0,x86_64,-jnone,-sdefault,-sdefault,-hcritbit
Debug: Child (57659) Started
Info: Child (57659) said Child starts
and creates a vcl_boot.*
folder in /usr/local/var/varnish
When i go to 127.0.0.1:8090
I see varnish is running but just get
Error 503 Backend fetch failed
Backend fetch failed
My /usr/local/etc/varnish/default.vcl
is pretty much the default:
#
# 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.
}
Does anyone know what I could be missing?
Thanks!
Upvotes: 0
Views: 1054
Reputation: 9895
In your command to run Varnish, I think you mistakenly use -T 127.0.0.1:8085
. The -T
switch is for:
Offer a management interface on the specified address and port.
So you're binding the Varnish management interface to the same port as your backend. Wonder why that doesn't fail anyway.
Upvotes: 1