@RR. could you guide me a bit on it or point me to some guide to start with. I have worked with varnish regarding php caching so i have the basic knowledge of varnish but i am just not getting on how to make it work with proxy_store. :(

Depending on your needs (for example SSL) you can put varnish in different places in the setup:


If you use SSL (which varnish itself doesn't support) you can use your proxy_store server as an SSL offloader:

1. [client] <- -> [nginx proxy_store server] <- -> [varnish] <- -> [content_server]

.. in this case when multiple requests land onto nginx proxy_store in case the file locally doesnt exist those are forwarded to varnish and combined into a single request to the content server.

A simplistic/generic nginx config:

location / {
   error_page      404 = @store;
}

location @store {
       internal;
       proxy_pass           http://imgstore;;
       proxy_store          on;
}


varnish config:

backend default {
   .host = "content_server.ip";
}
sub vcl_recv {
   set req.backend = default;
}


Obviously add whatever else you need (like forwarded-for headers to pass the real client ip, cache expire times etc).



2. In case you don't use SSL:

[client]  <- -> [varnish] <- ->  [content_server]
(optionally you put nginx or some other software like stud or pound on top of varnish as SSL offloader (personally I use Shrpx from Spdylay ( https://github.com/tatsuhiro-t/spdylay ))

Then generic varnish config would look bassically the same:

backend default {
   .host = "content_server.ip";
}
sub vcl_recv {
   set req.backend = default;
}

sub vcl_backend_response {
   set beresp.do_stream = true;
}



Hope that helps.

rr
_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to