nginx转发
通过nginx转发,用外网连接阿里云的redis,报Unexpected end of stream的解决办法
一、在与redis同一个内网的服务器上A的nginx做了下面的设置
stream {
upstream redis {
server redis.rds.aliyuncs.com:6379 max_fails=3 fail_timeout=30s;
}
server {
listen 6379;
proxy_connect_timeout 1s;
proxy_timeout 3s;
proxy_pass redis;
}
}
二、服务器B上通过A:6379 来连接到阿里云的redis
三、redis经常报错 Unexpected end of stream
四、解决办法,修改nginx的下面2个参数:
server {
listen 6379;
proxy_connect_timeout 10s;
proxy_timeout 30s;
proxy_pass redis;
}
}