Hi..guys<br><br>Thanks for the help, i creared the default.vcl with multiple back-ends , now my varnish is working fine can access both <a href="http://content.com">content.com</a> and <a href="http://content.org">content.org</a> sites without any problem , This is my configuration , is there any tips [configuration changes ] to get maxim performance or is there any draw backs in this configuration...<br>
<br>configuration<br>--------------------<br><br>backend bkcachecom {<br> .host = "10.100.1.1";<br> .port = "8080";<br>}<br><br><br>backend bkcacheorg {<br> .host = "10.100.1.2";<br>
.port = "8080";<br>}<br><br><br>sub vcl_recv {<br><br>if (req.http.host ~ "^<a href="http://a.content.org">a.content.org</a>$") {<br> set req.backend = bkcacheorg;<br> return (lookup);<br>
}<br><br>else if (req.http.host ~ "^<a href="http://b.content.org">b.content.org</a>$") {<br> set req.backend = bkcacheorg;<br> return (lookup);<br>}<br><br>else if (req.http.host ~ "^<a href="http://a.content.com">a.content.com</a>$") {<br>
set req.backend = bkcachecom;<br> return (lookup);<br>}<br><br>else if (req.http.host ~ "^<a href="http://b.content.com">b.content.com</a>$") {<br> set req.backend = bkcachecom;<br> return (lookup);<br>
}<br><br>sub vcl_fetch {<br> if (!beresp.cacheable) {<br> unset beresp.http.expires;<br> set beresp.http.cache-control = "max-age=900";<br>
set beresp.ttl = 1w;<br> set beresp.http.magicmarker = "1";<br> return (pass);<br> }<br> if (beresp.http.Set-Cookie) {<br> return (pass);<br>
}<br> return (deliver);<br> }<br> sub vcl_deliver {<br> return (deliver);<br> }<br><br><br>Thanks in Advance<br><br>Thank You<br><br><br><div class="gmail_quote">On 24 September 2012 21:34, Robert Socha <span dir="ltr"><<a href="mailto:socha@socha.it" target="_blank">socha@socha.it</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br>
<br>
<br>
W dniu 2012-09-24 16:11, dhanushka ranasinghe pisze:<br>
> Hi guys ,<br>
<div class="im">> With follwing configuration varnish only cache the content of the<br>
</div>> *<a href="http://content.org" target="_blank">content.org</a> <<a href="http://content.org" target="_blank">http://content.org</a>> * , its not caching the *<a href="http://content.com" target="_blank">content.com</a><br>
> <<a href="http://content.com" target="_blank">http://content.com</a>>* , Do i need to define multiple back-ends for each<br>
<div class="im">> virtual-hosts, can any one giude me how to do that .Or do i need to<br>
> configure separate Varnish instance for each VHOST.<br>
><br>
<br>
</div>You need define multiple backends. No need for separate instances.<br>
<br>
<br>
<br>
<br>
> server {<br>
> listen <a href="http://10.100.1.1:8080" target="_blank">10.100.1.1:8080</a> <<a href="http://10.100.1.1:8080" target="_blank">http://10.100.1.1:8080</a>>;<br>
> server_name <a href="http://content.com" target="_blank">content.com</a> <<a href="http://content.com" target="_blank">http://content.com</a>>;<br>
...<br>
<br>
backend bkcontentcom {<br>
.host = "10.100.1.1";<br>
.port = "8080";<br>
}<br>
<br>
<br>
> server {<br>
> listen <a href="http://10.100.1.2:8080" target="_blank">10.100.1.2:8080</a> <<a href="http://10.100.1.2:8080" target="_blank">http://10.100.1.2:8080</a>><br>
> server_name <a href="http://cache.org" target="_blank">cache.org</a> <<a href="http://cache.org" target="_blank">http://cache.org</a>>;<br>
...<br>
<br>
backend bkcacheorg {<br>
<div class="im"> .host = "10.100.1.2";<br>
.port = "8080";<br>
}<br>
<br>
</div>And in the begining of vcl_recv()<br>
<br>
if (req.http.host ~ "^(www\.)?content\.com$") {<br>
set req.backend = bkcontentcom;<br>
} else {<br>
// for <a href="http://cache.org" target="_blank">cache.org</a><br>
set req.backend = bkcacheorg;<br>
}<br>
<br>
<br>
<br>
And of course your backends need to provide correct Cache-Control<br>
headers (ie. max-age or s-max-age).<br>
<br>
Greetings<br>
<span class="HOEnZb"><font color="#888888">--<br>
Robert Socha<br>
<br>
<br>
<br>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</font></span></blockquote></div><br>