EDIT(1): The ".timeout" value does not seem to have any effect. The "503 Backend fetch failed" error is displayed immediately
Original Explanation: I am quite new with varnish. Any help is appreciated. I keep getting the below error every time I try to call my webpage with Varnish:
<body>
<h1>Error 503 Backend fetch failed</h1>
<p>Backend fetch failed</p>
<h3>Guru Meditation:</h3>
<p>XID: 3</p>
<hr>
<p>Varnish cache server</p>
</body>
Background: : I have a file index.php:
The below works:
curl --header "Host: serverx.dev" 192.168.56.10:8080/index.php
The below does not work and throws "Backend fetch failed" error:
curl --header "Host: serverx.dev" 192.168.56.10:80/index.php
I use the following:
Virtualbox 5.0.32 r112930
Host operating system: Windows 7 (64-bit)
Guest operating system: Debian Jessie (minimal install)
Apache2 -----port 8080
varnish-4.1.5 revision 2c82b1c -----port 80
default.vcl:
vcl 4.0;
# import default varnish library
import std;
import directors;
backend server1 {
.host = "192.168.56.10";
.port = "8080";
.probe = {
.url = "/robots.txt";
.interval = 5s;
.timeout = 50s;
.window = 5;
.threshold = 3;
}
}
sub vcl_init {
new cluster = directors.round_robin();
cluster.add_backend(server1);
}
The following is the current varnish status:
root@debian:/etc/varnish# ps -ef | grep varnish
varnish 4210 1 0 11:26 ? 00:00:00 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
vcache 4211 4210 0 11:26 ? 00:00:00 /usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m
root 4632 1470 0 11:40 pts/0 00:00:00 grep varnish
and also:
root@debian:/etc/varnish# netstat -anp | grep varnish
tcp 0 0 127.0.0.1:6082 0.0.0.0:* LISTEN 4210/varnishd
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4210/varnishd
tcp6 0 0 ::1:6082 :::* LISTEN 4210/varnishd
tcp6 0 0 :::80 :::* LISTEN 4210/varnishd
unix 2 [ ] DGRAM 35213 4210/varnishd
Apache2:
root@debian:/etc/varnish# netstat -anp | grep apache2
tcp6 0 0 :::443 :::* LISTEN 4461/apache2
tcp6 0 0 :::8080 :::* LISTEN 4461/apache2
Varnishlog gives following output
- BereqHeader X-Varnish: 51
- VCL_call BACKEND_FETCH
- VCL_return fetch
- FetchError Director cluster returned no backend
- FetchError No backend
- Timestamp Beresp: 1490091185.165509 0.000027 0.000027
- Timestamp Error: 1490091185.165513 0.000030 0.000004
- BerespProtocol HTTP/1.1
- BerespStatus 503
- BerespReason Service Unavailable
- BerespReason Backend fetch failed
- BerespHeader Date: Tue, 21 Mar 2017 10:13:05 GMT
- BerespHeader Server: Varnish
- VCL_call BACKEND_ERROR
I would be glad to provide more info.