Varnish configuration, NamevirtualHosts, and IP Forwarding
- by Brent
I currently have a bunch of NameVirtualHost based websites, load balanced between 3 apache2 servers using ldirectord. I would like to insert varnish as a reverse-web-proxy between ldirectord and apache in the following way:
a request comes in to ldirectord
it is then load balanced between the 3 apache2 servers and varnish, with a weight of 1 for the webservers, and 99 for varnish (so if varnish is rebooted, the webservers will take over seamlessly)
varnish will then load balance its requests between my apache2 servers.
However, the varnish part is not working.
I wonder whether this has to do with the fact that my apache servers use x.x.x.x:80 for their NameVirtualHosts, instead of *:80? (they have to do this, since each server hosts multiple IP addresses)
Or perhaps it has to do with the need for IP Forwarding to be set up on the varnish server? (I did echo 1 /proc/sys/net/ipv4/ip_forward on this server, is that sufficient?)
How can I debug this problem?
ldirectord doesn't produce logs of what it does with each request (and if it did, I would be overwhelmed with information since I'm serving hundreds of requests per second)
varnish log shows the ldirectord server connecting to it every 5 seconds, but nothing else.
I have set up a test site using this configuration, but it fails - no apache access logs, no applicable varnish logs.