Multiple backends on same server (cPanel)

Jerry Steele ticktockhouse at gmail.com
Fri Mar 21 11:07:02 CET 2014


Hello,

I seem to be having somewhat confusing issues with Varnish. I've got a
simple setup (as I haven't been using it that long, I haven't really
got into anything more complex).

backend default {
  .host = "11.22.33.208";
  .port = "8081";
}

backend default2 {
  .host = "11.22.33.210";
  .port = "8081";
}


## Multiple virtual hosts
sub vcl_recv {
if (req.http.host ~ "^domain1.com(:[0-9]+)?$";) {
      set req.backend = default;
}

elsif (req.http.host ~ "^domain2.co.uk(:[0-9]+)?$";) {
      set req.backend = default;
}
elsif (req.http.host ~ "^domain3.com(:[0-9]+)?$";) {
      set req.backend = default2;
}

Now, this seems to work well for domain1.com, domain2.co.uk (plus
subdomains - I'm not sure why this should be, as the regexes have the
^ anchor tag ?). The problem is, that this doesn't seem to work for
domain3.com, which is pointing to a different backend. Well, actually
it does work, in that it ends up at the server's default page (it's a
cPanel machine), rather than timing out. Fear not, I'm more command
line than a panel user :)

I've checked the virtualhosts are correct, and indeed the site is
visible at domain3.com:8081

I initially had a problem with domain3.com working, and
www.domain3.com going to the default page, which is why I've been
making changes.

Obviously, IPs and domain names have been changed to protect the innocent..

Does anyone have any ideas?

Thanks

--
---

Jerry Steele
Telephone: +44 (0)7920 237105
http://ticktockhouse.co.uk



More information about the varnish-misc mailing list