I will persist until I succeed
nginx四层转发配置
nginx四层转发配置

nginx四层转发配置

nginx做四层转发需要用到stream模块,编译时需要指定:–with-stream

–with-stream    enable  TCP/UDP  proxy module

在nginx配置文件里面跟http同级的配置段:

stream {
upstream mysql_3306{
server 172.18.0.10:3306;
}
server {
listen 23306;
proxy_connect_timeout 5s;
proxy_timeout 300s;
proxy_pass mysql_3306;
}

}

TCP  localhost:23306== > 172.18.0.10:3306

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注