How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

March 14, 2013

Varnish Error 503 Service unavailable… Guru Meditation

Filed under: Linux — Tags: , , — admin @ 2:07 pm

Today I have face a big problem while using varnish with nginxcp + cpanel on a vps server .
Well the main site was working that was using a wordpress, however admin area because have a lot of plugins crashed with that stupid error.
So after a long search in ngnix log I find this error
upstream prematurely closed connection while reading response header from upstream
and this
an upstream response is buffered to a temporary file

However this seem’s that are not the problem for unavailable problem. However a fix for those error is to disable log in proxy.inc just add
proxy_buffering off;

However the fix is this in the varnish configuration default.vcl
backend default {
.host = “127.0.0.1”;
.port = “81”;
}

So after I modify this with

backend default {
.host = “127.0.0.1”;
.port = “81”;
.connect_timeout = 120s;
.first_byte_timeout = 120s;
.between_bytes_timeout = 120s;
}

The problem suddenly disappear . So basically the timeout should be increased for admin area if you have a lot of plugins there in wordpress and you are on a small vps.

2 Comments »

  1. Dear thank you for the tutorial I did all of this config but I always got error : varnish Error 503 Service Unavailable I changed timeout and the same , I just want to install varnish only , I dnt need apache or Ngnix
    please if you can help me and if you have working config file send me it
    thank you

    Comment by alfanet1 — August 11, 2013 @ 10:43 am

  2. Hello
    “Varnish is a web application accelerator. You install it in front of your web application and it will speed it up significantly. ”
    So you can’t run varnish only. You have to install apache or other web server. Varnish is acting only like a caching server in front of it.

    Comment by admin — September 2, 2013 @ 10:10 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress