Nginx转发阿里云内网Redis

修改Nginx配置文件,加入流转发

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;

events {
    worker_connections  65535;
}

# redis 端口直接转发
stream {
    upstream redis {
        server  r-bp1234567890.redis.rds.aliyuncs.com:6379 max_fails=3 fail_timeout=30s; #*r-bp1234567890*替换为真实的redis地址
    }
    server {
        listen 6379;
        proxy_connect_timeout 1s;
        proxy_timeout 3s;
        proxy_pass redis;
    }
}
0%