I have some WCF-service on caching of images for our portal.
http://images.example.com/ImageProxy.ImageProxyService.svc/Image/Original/?uri=http://www.example.net/image.jpg
where:
[Original, Small, etc...] - size of image
http://www.example.net/image.jpg - source of image
I want to configure a server for caching on nginx too.
...
proxy_cache_path /var/cache/nginx/images levels=1:2 keys_zone=images:8m max_size=1000m inactive=600m;
...
server {
expires 24h;
add_header Cache-Control public;
listen 80;
server_name i.example.com;
location /img {
proxy_redirect off;
proxy_pass http://images.example.com/ImageProxy.ImageProxyService.svc/Image/;
proxy_cache images;
proxy_hide_header X-AspNet-Version;
proxy_hide_header X-Powered-By;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
}
location ~* /Image {
rewrite ^/([^/]*)(.*)$ /img$2;
}
}
On request, nothing is cached. - http://images.example.com/img/Original/?uri=http://www.example.com/image.jpg (The picture is displayed in the browser.)
But if you place the image in the root of the server. The cache works. http://images.example.com/image.jpg
How can I make caching in my case?