vhost configuration
Laurence Rowe
l at lrowe.co.uk
Sat Jul 24 22:51:25 CEST 2010
> ---------------- error messages ---------------------
>
> Expected one of
> 'acl', 'sub', 'backend', or 'director'
> Found: 'if' at
> (input Line 16 Pos 1)
> if (req.http.host ~ "^(www.)?aaa.com$") {
> ##-----------------------------------------
> Running VCC-compiler failed, exit 1
> VCL compilation failed
>
> --------------------------------------------------------
You need to put this in vcl_recv:
> ------------ VCL Configuration ----------------------
>
> backend aaa {
> .host = "1.1.1.1";
> .port = "80";
> }
> backend bbb {
> .host = "2.2.2.2.";
> .port = "80";
> }
sub vcl_recv {
> if (req.http.host ~ "^(www.)?aaa.com$") {
> set req.http.host = "www.aaa.com";
> set req.backend = aaar;
>
> } else if (req.http.host ~ "^(www.)?bbb.com$" {
> set req.http.host = "www.bbb.cpm";
> set req.backend = bbb;}
> else {
> req.backend = default.;
> }
> }
}
Laurence
More information about the varnish-misc
mailing list