Nginx redis, select database not working?

logar.damir nginx-forum at
Sat Jun 4 16:40:20 MSD 2011

I'm having problem with redis module:
(version 0.32 downloaded from mirror at 

As I tried, variable $redis_db is never used and result always comes
from "default" - database 0.  
Am I missing something in my config?

my nginx.conf (part of):
upstream { server; keepalive 256 single;} 

location /testredisselect0
	default_type text/html;
	set $redis_key "$uri?dbid=notdef";
	redis_pass redisbackend;

location /testredisselect1
	default_type text/html;
	set $redis_db "1";
	set $redis_key "$uri?dbid=1";
	redis_pass redisbackend;

curl "http://localhost/testredisselect0"
curl "http://localhost/testredisselect1"

result in redis monitor:
1307190385.099634 "select" "0"
1307190385.099688 "get" "/testredisselect0?dbid=notdef"
1307190387.739512 "select" "0"
1307190387.739561 "get" "/testredisselect1?dbid=1"

As I can see, command always issues select 0, although it should run
select 1 in second case.


Posted at Nginx Forum:,203861,203861#msg-203861

More information about the nginx mailing list