Varnish multiple backend configuration?
Dag-Erling Smørgrav
des at linpro.no
Wed Jun 6 11:27:05 CEST 2007
Nathan McSween <nwmcsween at gmail.com> writes:
> Would this work as a simple load balancer configuration?
Yes, except
> backend apache {
> set backend.host = ""; set backend.port = "80";
> }
>
> backend nginx {
> set backend.host = ""; set backend.port = "80";
> }
I assume you removed the host names intentionally before posting
> sub vcl_miss {
> if (req.url ~ "/.(php|py)$") {
> set req.backend = apache;
> fetch;
> } else (req.url ~ "/.(*)$") {
> set req.backend = nginx;
> fetch;
> }
> }
"else" does not take a condition, did you mean "else if"? In any case,
the second condition is not necessary, and neither are the two "fetch"
statements. The following should do:
sub vcl_miss {
if (req.url ~ "/.(php|py)$") {
set req.backend = apache;
} else {
set req.backend = nginx;
}
}
DES
--
Dag-Erling Smørgrav
Senior Software Developer
Linpro AS - www.linpro.no
More information about the varnish-misc
mailing list