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.
Subject Author Posted

Nginx cache files by mime type using ngx_srcache module

n1xman June 11, 2013 05:10AM

Re: Nginx cache files by mime type using ngx_srcache module

agentzh June 11, 2013 03:06PM

Re: Nginx cache files by mime type using ngx_srcache module

n1xman June 12, 2013 06:51AM

Re: Nginx cache files by mime type using ngx_srcache module

agentzh June 18, 2013 10:24AM

Re: Nginx cache files by mime type using ngx_srcache module

n1xman June 18, 2013 11:37AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 191
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready