Welcome! Log In Create A New Profile

Advanced

Please Help With Memcached Setup

August 09, 2010 09:43AM
Hi

I am running Nginx 0.7.67 with the Memc and Echo 3rd party modules in trying to follow http://agentzh.org/misc/slides/nginx-conf-scripting/nginx-conf-scripting.html#35.

I want to serve some static files from memcached and am trying a self updating setup as in the following pseudocode:
[code]
if request for specified files {
if in memcache {
serve from memcache
} else {
try to put into memcache
try to serve from memcache
if unable to serve from memcache {
proxy to apache
}
}
}
[/code]

I will actually prefer to do this...:
[code]
if request for specified files {
if in memcache {
serve from memcache
} else {
try to put into memcache
try to serve from memcache
if unable to serve from memcache {
[b]try to serve from disk[/b]
}
if unable to serve from memcache {
proxy to apache
}
}
}
[/code]
...but started to get too complicated and I can get to that after I manage to get it working in the first place

The relevant portion of my conf file is...:
[code]
location ~* ^.+\.(jpe?g|gif|png|css|js|ico|swf|dat|xml)$ {
set $memc_cmd 'get';
set $memc_key '$scheme://$host$request_uri';
memc_pass 127.0.0.1:11211;
add_header X-Memc-Flags $memc_flags;
error_page 404 = @add-and-retry;
error_page 502 = @fallback;
log_not_found off;
access_log /dev/null main;
}
location @add-and-retry {
echo_location /memc?cmd=add&key='$scheme://$host$request_uri'&val=$document_root$uri&exptime=0;
echo_location /memc?cmd=get&key='$scheme://$host$request_uri';
}
location /memc {
internal;
set $memc_cmd $arg_cmd;
set $memc_key $arg_key;
set $memc_value $arg_val;
set $memc_exptime $arg_exptime;
memc_pass 127.0.0.1:11211;
error_page 404 502 = @fallback;
}
location @fallback {
log_not_found off;
access_log /dev/null main;
proxy_pass http://127.0.0.1:8080;
# proxy params
include /etc/nginx/proxy.default;
}
[/code]
...but these files do not get served at all. I.E. it doesn't even get passed to apache.

Please help unravel or suggest alternative(s).

Thanks.
Subject Author Posted

Please Help With Memcached Setup

Dayo August 09, 2010 09:43AM

Re: Please Help With Memcached Setup

Dayo August 09, 2010 09:47AM

Re: Please Help With Memcached Setup

agentzh August 09, 2010 10:38PM

Re: Please Help With Memcached Setup

Dayo August 10, 2010 03:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 71
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready