Forward single request to upstream server via proxy_store !!

shahzaib shahzaib shahzaib.cb at gmail.com
Wed Sep 24 13:55:00 UTC 2014


@RR, That's great. Sure it will help me. I am starting to work with it on
local environment and will get back to you once the progress started :)

Thanks a lot for writing sample config for me !!

On Wed, Sep 24, 2014 at 6:32 PM, Reinis Rozitis <r at roze.lv> wrote:

> @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
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140924/78f0fd03/attachment.html>


More information about the nginx mailing list