I like your solution. But i'm getting error: nginx: [emerg] "expires" directive invalid value in /usr/local/nginx/conf/nginx.conf:131 nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed When using expires $caching_expires; Posted at Nginx Forum: http://forum.nginx.org/read.php?2,213841,213844#msg-213844