1.nginx增加编译组件
./configure --prefix=/home/tsaip/csss/nginx --with-pcre=../pcre-8.40 --with-stream --with-http_ssl_module
2.配置nginx
stream {
upstream cloudsocket {
hash $remote_addr consistent;
# $binary_remote_addr;
server 192.168.1.3:3306 weight=5 max_fails=3 fail_timeout=30s;
}
server {
listen 3306;#数据库服务器监听端口
proxy_connect_timeout 10s;
proxy_timeout 300s;#设置客户端和代理服务之间的超时时间,如果5分钟内没操作将自动断开。
proxy_pass cloudsocket;
}
}