<div><font face="courier new,monospace">Folks,</font></div>
<div><font face="courier new,monospace"></font> </div>
<div><font face="courier new,monospace">I am discovering Varnish which looks like a gift from Gods, or from Poul-Henning.</font></div>
<div><font face="courier new,monospace"></font> </div>
<div><font face="courier new,monospace">We have one case where clients gets big DDoS and we distibute HTTP servers between various ISP. I have set it up alright for one host, but now I need to do virtualhost as we have various sites.</font></div>
<div><font face="courier new,monospace"></font> </div>
<div><font face="courier new,monospace">Upon restart varnish does not start (no error and nothing in logs). Wondering what obvious I did wrong.</font></div>
<div><font face="courier new,monospace"></font> </div>
<div><font face="courier new,monospace">Here is my configuration:</font></div>
<div><font face="courier new,monospace"></font> </div><font face="courier new,monospace">
<div><font face="Courier New">/// start</font></div>
<p># This is a basic vcl.conf file for varnish.<br></p></font>
<div><font face="courier new,monospace">backend default {<br> set backend.host = "localhost";<br> set backend.port = "80";<br>}</font></div>
<div><font face="courier new,monospace">backend mysite1-com {<br> set backend.host = "</font><a href="http://www.mysite1.com/"><font face="courier new,monospace">www.mysite1.com</font></a><font face="courier new,monospace">";<br>
set backend.port = "80";<br>}</font></div>
<div><font face="courier new,monospace">backend mysite2-com {<br> set backend.host = "</font><a href="http://www.mysite2.com/"><font face="courier new,monospace">www.mysite2.com</font></a><font face="courier new,monospace">";<br>
set backend.port = "80";<br>}</font></div>
<div><font face="courier new,monospace">acl purge {<br> "localhost";<br>}</font></div>
<div><font face="courier new,monospace">sub vcl_recv {</font></div>
<div><font face="courier new,monospace"> # Knock knock, who's there ?<br> if (req.http.host ~ "^(www|www2|www3\.)?mysite1\.com$") {<br> set req.backend = mysite1-com;<br> } <br>
elseif (req.http.host ~ "^(www|www2|www3\.)?mysite2\.com$") {<br> set req.backend = mysite2-com;<br> }<br> else {<br> error 404 "Unknown virtual host";<br> }</font></div>
<div><font face="courier new,monospace"> if (req.request != "GET" && req.request != "HEAD") {<br> # PURGE request if zope asks nicely<br> if (req.request == "PURGE") {<br>
if (!client.ip ~ purge) {<br> error 405 "Not allowed.";<br> }<br> lookup;<br> }<br> pipe;<br> }</font></div>
<div><font face="courier new,monospace"> if (req.http.Expect) {<br> pipe;<br> }</font></div>
<div><font face="courier new,monospace"> if (req.http.Authenticate || req.http.Authorization) {<br> pass;<br> }</font></div>
<div><font face="courier new,monospace"> # We only care about the "__ac.*" cookies, used for authentication<br> if (req.http.Cookie && req.http.Cookie ~ "__ac(|_(name|password|persistent))=") {<br>
pass;<br> }</font></div>
<div><font face="courier new,monospace"> # File type that we will always cache<br> if (req.request == "GET" && req.url ~ "\.(gif|jpg|swf|css|js|png|jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|js|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar|rar)$") {<br>
lookup;<br> lookup;<br> }</font></div>
<div><font face="courier new,monospace"> if (req.request == "POST") {<br> pipe;<br> }</font></div>
<div><font face="courier new,monospace"> # force lookup even when cookies are present<br> if (req.request == "GET" && req.http.cookie) {<br> lookup;<br> }</font></div>
<div><font face="courier new,monospace"> if (req.http.Cache-Control ~ "no-cache") {<br> pass;<br> }<br> lookup;<br>}</font></div>
<div><font face="courier new,monospace">sub vcl_fetch {</font></div>
<div><font face="courier new,monospace"> # force minimum ttl of 300 seconds<br> if (obj.ttl < 3000s) {<br> set obj.ttl = 3000s;<br> }<br>}</font></div>
<div><font face="courier new,monospace"># Do the PURGE thing<br>sub vcl_hit {<br> if (req.request == "PURGE") {<br> set obj.ttl = 0s;<br> error 200 "Purged";<br> }<br>
}</font></div>
<div><font face="courier new,monospace">sub vcl_miss {<br> if (req.request == "PURGE") {<br> error 404 "Not in cache";<br> }<br>}</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">/// end</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">Any help is most welcome.</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">Regards.</font></div>
<div><font face="Courier New"></font> </div>
<div><font face="Courier New">- Vladimir</font></div>