nginx 代理 mysql,redis, ssh
nginx.conf
:
1 2 3
| stream { include /etc/nginx/stream.d/*.conf; }
|
/etc/nginx/stream.d/mysql.conf
:
1 2 3 4 5 6 7 8 9
| upstream cloudsocket { hash $remote_addr consistent; server 192.168.1.111:3306 weight=5 max_fails=3 fail_timeout=30s; } server { listen 3306; proxy_connect_timeout 10s; proxy_pass cloudsocket; }
|
redis
:
1 2 3 4 5 6 7 8 9
| upstream rediscloudsocket { hash $remote_addr consistent; server 192.168.11.111:6379 weight=5 max_fails=3 fail_timeout=30s; } server { listen 6379; proxy_connect_timeout 10s; proxy_pass rediscloudsocket; }
|
ssh
:
1 2 3 4 5 6 7 8 9
| upstream ssh { server 192.168.11.112:22; } server { listen 80; proxy_pass ssh; proxy_connect_timeout 1h; proxy_timeout 1h; }
|