NGINX and Varnish Connection failed (localhost:6082)

Posted March 20, 2014 5.3k views
My wordpress site gives error 521 all the times. When I found this error from my server ``` $sudo service varnish reload * Reloading HTTP accelerator varnishd Connection failed (localhost:6082) Error: vcl.load 8d6fb6be-9a0a-4896-be47-e2678e3c2617 /etc/varnish/default.vcl failed ``` Moreover, `varnishlog` shows nothing. I am following this [tutorial]( to set the server up. And, I changed ``` DAEMON_OPTS="-a :80 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -u www-data -g www-data \ -S /etc/varnish/secret \ -s malloc,256m" ``` The `/etc/varnish/default.vcl` file is copied from the tutorial. All &a mp; has been corrected to &. It is a fresh droplet. No firewall. Any clue to resolve it? Thanks!!!!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer
Can you try connecting to it manually to see if we can get some more useful error output:

varnishadm -T localhost:6082

Also, check out our Varnish, Nginx, Wordpress tutorial:
by Etel Sverdlov
Varnish is an HTTP accelerator and a useful tool for speeding up a server, especially during a times when there is high traffic to a site. It works by redirecting visitors to static pages whenever possible and only drawing on the server itself if there is a need for an active process. This tutorial covers installing wordpress on a LEMP stack (with nginx instead of apache), and then installing varnish.