tangrufus
tangrufus

Reputation: 357

Nginx & Varnish connection error

My 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 & has been corrected to &.

It is a fresh VPS. No firewall.

Any clue to resolve it?

Thanks!!!!

Upvotes: 0

Views: 738

Answers (2)

user3682259
user3682259

Reputation: 11

restart your varnish

sudo /etc/init.d/varnish restart

then

sudo /etc/init.d/varnish reload

Upvotes: 1

dark_skeleton
dark_skeleton

Reputation: 51

3 things come into my mind:

  1. Start varnish in foreground mode and check what it says

    varnishd -F -a :80 \
    -T localhost:6082 \
    -f /etc/varnish/default.vcl \
    -u www-data -g www-data \
    -S /etc/varnish/secret \
    -s malloc,256m
    
  2. Try changing -T localhost:6082 to -T 127.0.0.1:6082

  3. Your port 6082 might be already taken. Change it or check if it's listed in already open ports' list with

    netstat -tlnep
    

Upvotes: 2

Related Questions