backend default { |
.host = "127.0.0.1" ; |
.port = "8080" ; |
} |
|
sub vcl_recv { |
if (req.http.host ~ "photo.com" ) |
{ |
unset req.http.cookie; |
return (lookup); |
} |
|
} |
|
sub vcl_deliver |
{ |
set resp.http.Expires = "Sun, 17 Feb 2013 05:00:00 GMT" ; |
unset resp.http.X-Varnish; |
unset resp.http.Age; |
unset resp.http.Via; |
unset resp.http.Connection; |
set resp.http.Cache-Control = "max-age=2592000" ; |
set resp.http.Last-Modified = "Sat, 24 Dec 2011 01:24:34 GMT" ; |
if (obj.hits > 0) |
{ |
set resp.status=304; |
} |
} |
#启动 |
/usr/local/varnish/sbin/varnishd -f /usr/local/varnish/etc/varnish/ default .vcl -s malloc,1G -a 127.0.0.1:80 |