11 messages in ru.sysoev.nginxRe: question about proxy_store
FromSent OnAttachments
eliottJan 26, 2008 7:18 pm 
Cliff WellsJan 27, 2008 9:10 pm 
eliottJan 27, 2008 10:13 pm 
Igor SysoevJan 27, 2008 10:21 pm 
eliottJan 27, 2008 10:31 pm 
Igor SysoevJan 27, 2008 10:58 pm 
Volodymyr KostyrkoJan 28, 2008 12:54 am 
Igor SysoevJan 28, 2008 1:36 am 
Cliff WellsJan 28, 2008 2:11 am 
Volodymyr KostyrkoJan 28, 2008 2:49 am 
eliottJan 28, 2008 7:06 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: question about proxy_storeActions...
From:eliott (elio@public.gmane.org)
Date:Jan 28, 2008 7:06:02 pm
List:ru.sysoev.nginx

I actually tested both methods presented above, and got them both to work.

######## method 1 was copied nearly verbatim from Igor's example. Thanks Igor!

location / { root /var/www/data/example.com/fetch; error_page 404 = /fetch$uri; }

location ^~ /fetch/ { internal; include proxy.conf; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:9001; proxy_store /var/www/data/example.com$uri; proxy_store_access user:rw group:rw all:r; }

location ~ /$ { index index.html; root /var/www/data/example.com/fetch; error_page 403 404 = @fetch; }

location @fetch { internal; include proxy.conf; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:9001; proxy_store /var/www/data/example.com/fetch${uri}index.html; proxy_store_access user:rw group:rw all:r; }

######## Method 2 required some minor adjustment Thanks Volodymyr!

location / { root /var/www/data/example.com/fetch; if (-f $request_filename/_cache.html) { rewrite (.*) $1/_cache.html; } error_page 403 404 = /fetch$uri; }

location ^~ /fetch/ { internal; include proxy.conf; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://127.0.0.1:9001; proxy_store /var/www/data/example.com${uri}_cache.html; proxy_store_access user:rw group:rw all:r; }

########

I am not sure which method is better. The first method results in a proper site structure that you could tar up and move to another box, or serve from another webserver, and it would be functional.

The second method is shorter and simpler, while it is tied more closely to custom rewrite rules and an odd file extension.

I think for now I want the first method, for the ability to be more highly portable. I can rsync the output around if I want to.

Thanks for all the help in this thread. It was a nice first experience on the mailing list for me. :)