Multiple backends on same server (cPanel)

Dridi Boukelmoune dridi.boukelmoune at zenika.com
Fri Mar 21 11:23:31 CET 2014


On Fri, Mar 21, 2014 at 11:19 AM, MAGNIEN, Thierry
<thierry.magnien at sfr.com> wrote:
> Hi,
>
> I would say that none of your regex works and you always end up using the default backend. That why you think it works for domain1 and domain2.

One way to easily check that is to swap the backend declarations:

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

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

[...]

Cheers,
Dridi

> Regards,
> Thierry
>
> -----Message d'origine-----
> De : varnish-misc-bounces+thierry.magnien=sfr.com at varnish-cache.org [mailto:varnish-misc-bounces+thierry.magnien=sfr.com at varnish-cache.org] De la part de Jerry Steele
> Envoyé : vendredi 21 mars 2014 11:07
> À : varnish-misc at varnish-cache.org
> Objet : Multiple backends on same server (cPanel)
>
> 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
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc



More information about the varnish-misc mailing list