Welcome! Log In Create A New Profile

Advanced

Re: Nginx cache files by mime type using ngx_srcache module

June 12, 2013 06:51AM
Hi agentzh,

Thanks for the support and it is working :)

However, I have noticed every srcache_fetch GET /memc subrequest hits the memcached even though srcache_store skipped content-type which is not defined.

This will keep busy the memcached server and I think srcache_fetch GET subrequest should not executed if srcache_store_skip triggered first. Or am I missing something here...

map $upstream_http_content_type $no_store {
default 1;
~*html 0;
}

server {
..

location /memc {
internal;
set_unescape_uri $memc_key $arg_key;
set $memc_key $arg_key;
set $memc_exptime $arg_exptime;
memc_pass 127.0.0.1:11211;
}

location / {
srcache_response_cache_control off;
set_escape_uri $key $uri$args;
set $ttl_1d 60;
srcache_fetch GET /memc key=$key;
srcache_store PUT /memc key=$key&exptime=$ttl_1d;
srcache_store_statuses 200;
proxy_pass http://192.168.0.61:900;
srcache_store_skip $no_store;

}
..
}

Find the debug logs when firing following urls

curl -i http://192.168.0.160/index.html < served from the memcached
curl -i http://192.168.0.160/santa.jpg < not served from the memcached but the request hits the memcached

error.log
http://pastebin.com/jbMm83qh

[root@localhost conf.d]# nginx -V
nginx version: nginx/1.4.1
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-mail_ssl_module --with-file-aio --without-mail_smtp_module --without-mail_imap_module --without-mail_pop3_module --with-debug --with-http_spdy_module --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/ngx_devel_kit-master --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/echo-nginx-module-master --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/set-misc-nginx-module-master --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/srcache-nginx-module-master --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/nginx-sticky-module-1.1 --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/nginx_upstream_check_module-master --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/memc-nginx-module-master --add-module=/usr/local/hirantha/rpmbuild/BUILD/nginx-1.4.1/contrib/nginx_cross_origin_module-master --with-cc-opt='-O2 -g'

Really appreciate your support here.
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: 246
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready