Hello Per,

Thanks for your reply, i have tried the configuration given on the link.
However i receive the following error when i start varnish

Expected 'acl', 'sub' or 'backend', found 'backend_round_robin' at
(/etc/varnish/test.vcl Line 1 Pos 1)
backend_round_robin rr {

Can you please clarify why the error comes. I tried different ways to set
it. But no luck. Also attaching the vcl FYR.

Regards,
Kevin Fernandes

On Jan 3, 2008 8:06 PM, Per Andreas Buer <[EMAIL PROTECTED]> wrote:

> Hi Kevin.
>
> kevin fernandes:
>
> > I require the varnish configuration for adding multiple backend
> > webservers. Please provide me few examples on how to do it. In short i
> > require the configuration of distributing the http-requests to
> > different backend webservers.
>
> Is this what you are looking for?
> http://varnish.projects.linpro.no/wiki/Backends
>
>
>
> --
> Per Andreas Buer / Linpro AS   t: 21 54 41 21 / m: 958 39 117
> http://linpro.no/ - Ledende på Linux og åpen kildekode.
>
>
backend_round_robin rr {
        set backend.set = {
                { "xx.xx.xx.xx", "http" }
                { "xx.xx.xx.xx", "http" }
        };
}


acl purge {
    "localhost";
    "127.0.0.1";
}

# Caching mime types

sub vcl_recv {

        if (req.http.host ~ "example.com") {
                        req.backend = rr;
        }

        if (req.request == "GET" &&  req.url ~ 
"\.(css|gif|jpg|png|js|bmp|flv|jpeg|ico|mp3|mp4)$") {
                lookup;
        }

        /* Do not cache if request is not GET or HEAD */
        if (req.request != "GET" && req.request != "HEAD") {
                /* Forward to 'lookup' if request is an authorized PURGE 
request */
                if (req.request == "PURGE") {
                    if (!client.ip ~ purge) {
                        error 405 "Not allowed.";
                    }
                    lookup;
                }
                pipe ;
        }

        /* Do not cache if request contains an Expect header */
        if (req.http.Expect) {
                pipe ;
        }

        /* Varnish doesn't do INM requests so pass it through */
        if (req.http.If-None-Match) {
                pass;
        }

        /* Do not cache when authenticated via HTTP Basic or Digest 
Authentication */
        if (req.http.Authenticate || req.http.Authorization) {
                pipe ;
        }

        /* Do not cache when authenticated via "__ac" cookies */
        if (req.http.Cookie && req.http.Cookie ~ 
"__ac_(name|password|persistent)=") {
                pipe;
        }

        if (req.http.Cache-Control ~ "no-cache") {
                 pass;
        }

        if (req.url ~ "account.login") {
                pipe ;
        }

        lookup;
}

sub vcl_fetch {
        # force minimum ttl of 300 seconds
        if (obj.ttl < 300s) {
                set obj.ttl = 300s;
        }
}

# Do the PURGE thing
sub vcl_hit {
        if (req.request == "PURGE") {
                set obj.ttl = 0s;
                error 200 "Purged";
        }
}

sub vcl_miss {

         /* Varnish doesn't do IMS to backend, so if not in cache just pass it 
through */
        if (req.http.If-Modified-Since) {
                pass;
        }

        if (req.request == "PURGE") {
                error 404 "Not in cache";
        }


}
_______________________________________________
varnish-misc mailing list
[email protected]
http://projects.linpro.no/mailman/listinfo/varnish-misc

Reply via email to