Nginx反向代理Mysql

数据库过大(懒得同步),该服务器又没有公网环境,索性让有公网IP的服务器做个代理。

http{
...
}

stream {
    upstream mysql {
        hash $remote_addr consistent;
        server 10.0.10.2:3306 weight=5 max_fails=5 fail_timeout=30s;
    }

    server {
        listen                3306;
        proxy_connect_timeout 30s;
        proxy_timeout         300s;
        proxy_pass            mysql;
    }
}
posted @ 2020-12-29 12:39  MegaloBox  阅读(503)  评论(0编辑  收藏  举报