13

I'm installing Varnish following Varnish 3.0.2 documentation

/etc/varnish/default.vcl

backend default {
    .host = "127.0.0.1";
    .port = "80";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .between_bytes_timeout = 600s;
}

Lunch command

sudo varnishd -f /etc/varnish/default.vcl -s malloc,200M -T 127.0.0.1:2000 -a 0.0.0.0:8080

Documentation: https://www.varnish-cache.org/docs/3.0/tutorial/backend_servers.html

I just trying to listen on :8080, but i get this error:

enter image description here

Varnishlog

[ps]$ varnishlog

    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118941 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118944 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118947 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118950 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118953 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118956 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118959 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118962 1.0
   11 SessionOpen  c 173.245.49.79 20945 0.0.0.0:8080
   11 ReqStart     c 173.245.49.79 20945 647832555
   11 RxRequest    c GET
   11 RxURL        c /
   11 RxProtocol   c HTTP/1.1
   11 RxHeader     c Host: webtelevideo.com:8080
   11 RxHeader     c Connection: Keep-Alive
   11 RxHeader     c Accept-Encoding: gzip
   11 RxHeader     c CF-Connecting-IP: 79.41.59.48
   11 RxHeader     c CF-IPCountry: IT
   11 RxHeader     c X-Forwarded-For: 79.41.59.48
   11 RxHeader     c CF-Visitor: {"scheme":"http"}
   11 RxHeader     c User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11
   11 RxHeader     c Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
   11 RxHeader     c Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4
   11 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
   11 RxHeader     c Cookie: __cfduid=d1b65ec66cd2922d0e80af7bd912710f51327781669; mp_super_properties=%7B%22all%22%3A%20%7B%22%24initial_referrer%22%3A%20%22http%3A//www.google.it/url%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26source%3Dweb%26cd%3D6%26ved%3D0CGUQFjAF%26url%3Dhttp
   11 VCL_call     c recv pass
   11 VCL_call     c hash
   11 Hash         c /
   11 Hash         c webtelevideo.com:8080
   11 VCL_return   c hash
   11 VCL_call     c pass pass
   11 FetchError   c no backend connection
   11 VCL_call     c error deliver
   11 VCL_call     c deliver deliver
   11 TxProtocol   c HTTP/1.1
   11 TxStatus     c 503
   11 TxResponse   c Service Unavailable
   11 TxHeader     c Server: Varnish
   11 TxHeader     c Content-Type: text/html; charset=utf-8
   11 TxHeader     c Retry-After: 5
   11 TxHeader     c Content-Length: 418
   11 TxHeader     c Accept-Ranges: bytes
   11 TxHeader     c Date: Mon, 13 Feb 2012 07:42:43 GMT
   11 TxHeader     c X-Varnish: 647832555
   11 TxHeader     c Age: 0
   11 TxHeader     c Via: 1.1 varnish
   11 TxHeader     c Connection: close
   11 Length       c 418
   11 ReqEnd       c 647832555 1329118962.983350515 1329118963.179714441 0.043004036 0.196314096 0.000049829
   11 SessionClose c error
   11 StatSess     c 173.245.49.79 20945 0 1 1 0 1 0 256 418
   11 SessionOpen  c 173.245.49.79 9190 0.0.0.0:8080
   11 ReqStart     c 173.245.49.79 9190 647832556
   11 RxRequest    c GET
   11 RxURL        c /favicon.ico
   11 RxProtocol   c HTTP/1.0
   11 RxHeader     c Host: webtelevideo.com:8080
   11 RxHeader     c Connection: Keep-Alive
   11 RxHeader     c Accept-Encoding: gzip
   11 RxHeader     c CF-Connecting-IP: 79.41.59.48
   11 RxHeader     c CF-IPCountry: IT
   11 RxHeader     c X-Forwarded-For: 79.41.59.48
   11 RxHeader     c CF-Visitor: {"scheme":"http"}
   11 RxHeader     c Accept: */*
   11 RxHeader     c User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.46 Safari/535.11
   11 RxHeader     c Accept-Language: it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4
   11 RxHeader     c Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
   11 RxHeader     c Cookie: __cfduid=d1b65ec66cd2922d0e80af7bd912710f51327781669; mp_super_properties=%7B%22all%22%3A%20%7B%22%24initial_referrer%22%3A%20%22http%3A//www.google.it/url%3Fsa%3Dt%26rct%3Dj%26q%3D%26esrc%3Ds%26source%3Dweb%26cd%3D6%26ved%3D0CGUQFjAF%26url%3Dhttp
   11 VCL_call     c recv pass
   11 VCL_call     c hash
   11 Hash         c /favicon.ico
   11 Hash         c webtelevideo.com:8080
   11 VCL_return   c hash
   11 VCL_call     c pass pass
   11 FetchError   c no backend connection
   11 VCL_call     c error deliver
   11 VCL_call     c deliver deliver
   11 TxProtocol   c HTTP/1.1
   11 TxStatus     c 503
   11 TxResponse   c Service Unavailable
   11 TxHeader     c Server: Varnish
   11 TxHeader     c Content-Type: text/html; charset=utf-8
   11 TxHeader     c Retry-After: 5
   11 TxHeader     c Content-Length: 418
   11 TxHeader     c Accept-Ranges: bytes
   11 TxHeader     c Date: Mon, 13 Feb 2012 07:42:43 GMT
   11 TxHeader     c X-Varnish: 647832556
   11 TxHeader     c Age: 0
   11 TxHeader     c Via: 1.1 varnish
   11 TxHeader     c Connection: close
   11 Length       c 418
   11 ReqEnd       c 647832556 1329118963.855353355 1329118963.855585337 0.000086069 0.000171423 0.000060558
   11 SessionClose c error
   11 StatSess     c 173.245.49.79 9190 0 1 1 0 1 0 256 418
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118965 1.0
    0 CLI          - Rd ping
    0 CLI          - Wr 200 19 PONG 1329118968 1.0

webtelevideo.com:80 works correctly

sparkle
  • 7,530
  • 22
  • 69
  • 131
  • 1
    Guru Meditation is a nod to the old Amiga systems. – Adam Arold Nov 22 '14 at 02:28
  • For the benefit of future searchers, I'm going to comment that either `varnish` *may* have changed the error-name, or it's configurable or something - I've been seeing the 503 error `Odnamrod Meditation: Xid...` around, and have *not* been able to track down what tool generates it. The closest thing appears to be `varnish`, but it's not in the docs. – John C Oct 02 '22 at 13:30

2 Answers2

10

Your back-end server is not running. You've configured back-end host "127.0.0.1" but should have used "173.245.60.43" (the ip-address of webtelevideo.com).

ivy
  • 5,539
  • 1
  • 34
  • 48
  • Varnish log: 11 FetchError c no backend connection – sparkle Feb 12 '12 at 22:26
  • updated post with all varnish log – sparkle Feb 13 '12 at 11:35
  • 1
    In this order: is the service on 127.0.0.1 port 80 running (do a `telnet 127.0.0.1 80`)? Is it serving a proper (non 503) page on virtualhost webtelevideo.com? Is the Varnish process allowed to connect to port 80? – ivy Feb 13 '12 at 12:20
  • "telnet 127.0.0.1 80" => "Unable to connect to remote host: Connection refused". How to check if Varnish process allowed to connect to port 80? – sparkle Feb 13 '12 at 12:52
  • 2
    You don't need to: there is no server running on 127.0.0.1:80. This is your backend server (according to your vcl). How do you normally connect to your back-end server? You could insert the ip-address of webtelevideo.com instead of 127.0.0.1, depending on your routing... – ivy Feb 13 '12 at 12:54
  • I tried with: "telnet webtelevideo.com 80" => Connection closed by foreign host. (on Dreamhost) – sparkle Feb 13 '12 at 13:04
  • I just read that Telnet is disabled on Private Server on Dreamhost. It's replaced by SSH – sparkle Feb 13 '12 at 13:09
  • Eh, telnet is just my (really) old-fashioned way to check if you can connect to a port. I'm not talking about telnet login (deprecated in favor of ssh for over 15 years), but to start your own HTTP session (e.g. type `GET /` followed by two returns). Trying `wget` or `curl http://webtelevideo.com:80/` makes more sense, but these tools are not available on every unix installation... – ivy Feb 13 '12 at 13:17
  • 1
    Anyway, could you try setting .host = "173.245.60.43"? – ivy Feb 13 '12 at 13:19
  • Yes! now it works! i typed "hostname" and used that ip address to connect! Now works! Thank you! :) – sparkle Feb 13 '12 at 13:22
  • 1
    This is flagged as not an answer and to be honest I don't see one either except two questions. Maybe one of you could edit in what the solution was? Failing that I'll need to convert this to comments on the question. Thanks. /cc @user1028100 – Kev Feb 13 '12 at 22:38
  • Ivy, this was a great help getting Varnish to work on my server. I was about to throw in the towel until I changed 127.0.0.1 to the physical IP. – yitwail Nov 17 '12 at 10:16
4

When you see this error that means most of the case your backend is down. Which is confirmed by your message in varnishlog : Varnish log: 11 FetchError c no backend connection.

Check your origin server is up and your HTTP service (Apache/Nginx/other) is running.

Jérôme R
  • 1,227
  • 2
  • 13
  • 23