I'm in the baby step stages of setting up Varnish for the first time and I think I must have some fundamental misunderstanding. For the purpose of testing, I've left /etc/default/varnish
in its default config:
DAEMON_OPTS="-a :6081 \
-T localhost:6082 \
-f /etc/varnish/default.vcl \
-S /etc/varnish/secret \
-s malloc,256m"
My /etc/varnish/default.vcl
has this content (my Nginx virtual host is still listening on port 80 for now):
backend default {
.host = "127.0.0.1";
.port = "80";
}
My Nginx server
block contains this:
listen 80;
For good measure, netstat
shows listeners on those key ports:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6081 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN
As I understand it from reading a lot of posts on the topic, I should be able to open my.site.com:6081 in a browser to have traffic routed through Varnish to Nginx and back. I'm not seeing that. I get a connection error instead. At this point, I'm not trying to do anything sophisticated; I just want to establish communication and retrieve content.
I have no doubt this is a me issue and not a Varnish issue, but I don't see where I've gone wrong. I can't see any key difference between my ultra-basic config and what I've found online. Where have I gone wrong?
Any remedial assistance would be much appreciated.
Looks like network problem.
Do you have some kind of firewall protecting ports? Could you connect to Varnish locally from the server with
curl -I -H 'Host:my.site.com' http://localhost:6081/
or
telnet 127.0.0.1 6081