How can I get the value from Redis and put it in a

2019-03-03 08:30发布

Here is my config:

location = /session {
            set $redis_key "$cookie_session";
            redis_pass 000.00.000.000:6379;
            echo $cookie_session;
            echo ' - ';
            echo $redis_key;
    }

The echos are there for testing purposes. And I hid the IP.

I am trying to get my sessions data from Redis via NGiNX. This is why I installed HttpRedis.

What I don't understand is how I can get the data from Redis then put it in a variable. So I can use it as I please.

1条回答
Melony?
2楼-- · 2019-03-03 08:57

Use the NGiNX-Eval-Module: https://github.com/vkholodkov/nginx-eval-module

This is how you do it:

eval $var {
    set $redis_key $uri;
    redis_pass 000.00.000.000:6379;
}
查看更多
登录 后发表回答