multiple domains in one backend & 2 varnish servers

Kristian Lyngstol kristian at
Wed Apr 22 10:54:11 CEST 2009

On Tue, Apr 21, 2009 at 12:46:15PM +0200, Andreas Kaiser - Atela CC wrote:
> should be served by Europe server and others by the usa server I think I 
> need to configure each varnish install with a specific vcl config file. 

Why? They'll be working against the same backend server, and the
Host-header differentiates between each domain.

> What I don't have clear is if I need to use as backend only the IP of 
> the CMS server or multiple backends for every domain, also all domains 
> would have the same configuration related with cookies, compression, etc:

You only need to define one backend if you only have one backend.
> My experience with varnish is related with one webserver with one domain 
> that also has varnish installed... If I'm not wrong, varnish would 
> create a cache for each hostname/domain but I'm lost how varnish and 
> cmsserver should be configured for showing the specific content for each 
> domain if the servers are different ones...

No configuration needed. Your webserver reads the Host: header which is
part of HTTP 1.1, and Varnish, by default, uses this header combined with
the URL as part of the cache hash.

In essence: There's no difference in configuration from just having one
domain and having multiple domains. There are some differences when you
start talking purging, since the old purge.url doesn't supply a hostname,
but with http-based PURGE in vcl_hit, this isn't an issue. And with
purge.regexp or the new purge system, it's not an issue either.

> The reason of this configuration is that the cms-server will be only 
> accessible from a private network and the 2 varnish server (which will 
> be used as public frontend servers) Would varnish be a good choice in 
> this situation?

From the information you've given, it sounds like a reasonable choice, yes.

Kristian Lyngstøl
Redpill Linpro AS
Tlf: +47 21544179
Mob: +47 99014497
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <>

More information about the varnish-misc mailing list