a few intro to Varnish questions

Jason S-M slackmoehrle.lists at gmail.com
Tue Jan 18 23:25:55 CET 2011


Hi,

Thanks for the reply. very helpful.

>> So I have to run varnish on 80 and my site on an alternate port (8080 as example)? Or do they both run on port 80?
> 
> Yes, you need to run varnish on port 80, so that all requests hit Varnish first, Varnish will then fetch contents from your Apache server running on any other port ie. 8080, cache it and send response to requesting client.

I put Varnish on 80 using: 

varnishd -f /etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 75.149.56.27:80

and I changed httpd.conf to: Listen 127.0.0.1:8080

in /etc/varnish/default.vcl I have:
backend default {
 .host = "127.0.0.1";
 .port = "8080";
}

Upon doing this and hitting my url: http://6colors.net it seems to be in an infinite loop, Chrome just seems to loop and loop and loop.

>> 3. I must make additions to vcl_recv I assume to cache what I want?
> 
> In vcl_recv, you can select what you want to serve from cache, you might want to serve php pages directly and cache only static contents, depending on your requirements, in vcl_fetch  you need to set how long you want content to be cached, setting TTL, you can also set TTL based on content types, please read the doc firsthttp://www.varnish-cache.org/docs/2.1/

I am confused. Can we use an example? Say I wanted to cache these:

/mediaroom/video/keynotes/WWDC_2010/Apple_Special_Event.mp4
/mediaroom/video/keynotes/WWDC_2010/Apple_Special_Event.ogv

/mediaroom/video/keynotes/WWDC_2009/Apple_Special_Event.mp4
/mediaroom/video/keynotes/WWDC_2009/Apple_Special_Event.ogv

/mediaroom/video/special_events/2010/October/Apple_Special_Event.mp4
/mediaroom/video/special_events/2010/October/Apple_Special_Event.ogv

Thanks for explaining, I appreciate it. Some of these docs seems confusing!

-Jason





More information about the varnish-misc mailing list