Welcome! Log In Create A New Profile

Advanced

Nginx cache files by mime type using ngx_srcache module

June 11, 2013 05:10AM
Hi,

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. http://www.example.com/this-is-my-site )

Is this possible with ngx_srcache module using map module or something similar..

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 extension…?

location ~* \.(html)$ {
set $key $uri$args;
srcache_fetch GET /memc key=$key;
srcache_store PUT /memc key=$key&exptime=$ttl_1m;
proxy_pass http://www.example.com;
}

Any help to this is really appreciated.

Thanks in advance.
SubjectAuthorPosted

Nginx cache files by mime type using ngx_srcache module

n1xmanJune 11, 2013 05:10AM

Re: Nginx cache files by mime type using ngx_srcache module

agentzhJune 11, 2013 03:06PM

Re: Nginx cache files by mime type using ngx_srcache module

n1xmanJune 12, 2013 06:51AM

Re: Nginx cache files by mime type using ngx_srcache module

agentzhJune 18, 2013 10:24AM

Re: Nginx cache files by mime type using ngx_srcache module

n1xmanJune 18, 2013 11:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 69
Record Number of Users: 7 on March 06, 2014
Record Number of Guests: 229 on August 01, 2014
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by Percona     ipv6 ready