I'm trying to configure handle request direct from nginx using redis cache, cache already added to redis the problem is to configure nginx get the cache from redis
URL is like http://example.com/action.js?param1=10¶m2=text
Redis key is depend on param1
in the following example it use the full path as the key for redis
so i want to capture the param1 to get key which is like "cahced_page_"+param1
server {
listen 80;
server_name your.website.com;
root /home/appuser/app/current/public;
error_log /dev/null crit; #real man don't log
location / {
set $redis_db "1";
set $redis_key $uri;
default_type text/html;
redis_pass redis;
error_page 404 405 502 504 = @fallback;
}
location @fallback {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://yourunicornupstream;
break;
}
}
}
Best Answer
from http://wiki.nginx.org/HttpEchoModule#Variables