ljymoonlight

导航

nginx 进行tcpip 数据端口映射

TCP port mapping

stream{
upstream tcpLink {
hash $remote_addr consistent;
server xxx:3306 weight=5 max_fails=3 fail_timeout=30s;
}

server {
listen 7000;
proxy_connect_timeout 1s;
#proxy_timeout 3s;
proxy_pass tcpLink;
}

}

作用

  • 例如: 云数据库中远程访问需要设置白名单IP,当然也可以不设置,但公司项目由不得你。
    然后在支持远程访问的主机中运行nginx conf文件中配置端口映射
  • 本地电脑访问远程主机配置和7000端口,即可调试。

posted on 2023-03-25 23:54  ljymoonlight  阅读(271)  评论(0编辑  收藏  举报