0

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?

  • Ubuntu 12.04
  • Varnish 3.0.2
  • Nginx 1.1.19

Any remedial assistance would be much appreciated.

Rob Wilkerson
  • 40,476
  • 42
  • 137
  • 192

1 Answers1

0

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
ghloogh
  • 1,634
  • 16
  • 9
  • I can telnet fine from the box, but not from at least one external source. I'm not aware of any ports being closed so I didn't expect that. Thanks. – Rob Wilkerson Jun 25 '13 at 14:05
  • What connection error do you see? Varnish error page or browser error page? If Varnish, then do you see some output with varnishlog tool when trying access Varnish from external source? to check: run varnishlog on the server and then launch curl -I http://my.site.com:6081/ locally – ghloogh Jun 25 '13 at 15:09
  • Browser. Just confirmed via client's IT folks that 6081 is blocked. I'm sure that's the issue. Thanks for your help. – Rob Wilkerson Jun 25 '13 at 16:42