Nginx cache files by mime type using ngx_srcache module

n1xman nginx-forum at
Tue Jun 11 09:10:20 UTC 2013


I’m using ngx_srcache module with Memcached to cache static contents of the
upstream servers. This is based on static file extensions. Now I need to
cached them by looking at Content-Type of the header to cache .html pages as
we do not use the .html extension. (i.e. )

Is this possible with ngx_srcache module using map module or something

http {
map $upstream_http_content_type $no_proxy {
default 0;
~*^html/ 0;

and hook this $no_proxy to ngx_srcache variables like I’m doing with

    location ~* \.(html)$ {
                        set $key  $uri$args;
                        srcache_fetch GET /memc key=$key;
                        srcache_store PUT /memc key=$key&exptime=$ttl_1m;

Any help to this is really appreciated.

Thanks in advance.

Posted at Nginx Forum:,240023,240023#msg-240023

More information about the nginx mailing list