i have a large site with lot of pages that almost never change, right now i am using two memcache servers (amazon elasticache), but this its really expensive.
Thats why for this files that barely never change i want to upload them to amazon s3 and shutdown 1 memcache server.
Here is my conf;
location ~ /longterm/(.*){
proxy_pass http://amazonS3bucket;
proxy_intercept_errors on;
proxy_next_upstream http_404;
error_page 404 503 = @fallback_memcached
}
location @fallback_memcache {
set $memcached_key $uri;
memcached_pass name:11211;
error_page 404 @fallback;
}
location @fallback {
try_files $uri $uri/index.html
}
I dont know why but the config doesnt work on the final fallback; if i got an amazon S3 hit it works, if i got an amazon S3 miss and a memcache hit it works, but if i got an amazon S3 miss then a memcache miss when it try to resolve the las fallback it fails.
I am also thinking in use the amazon s3 fuse http://code.google.com/p/s3fs/ instead of the proxy pass i think it would be easier for implement, i would also be less performant?
Just a quote from the official documentation: