多server的解析问题 #49

Open
loveshell opened this Issue Jul 14, 2012 · 5 comments

3 participants

@loveshell

tcp {

    upstream cluster1 {
        server 192.168.1.38:3306;
    }

    upstream cluster2 {
        server 192.168.1.196:3306;
    }
    server {
        listen 8888;
        server_name dd.com;
        proxy_pass cluster1;
    }
    server {
        listen 8888;
        server_name d1.com;
        proxy_pass cluster2;
    }
}

当我链接d1.com的8888端口的时候,链接到的还是dd.com的8888端口,如何解决

@yaoweibin
Owner
@loveshell

我写的3306其实是ssh端口,早测试过,协议不同,根本没法用。

@loveshell loveshell closed this Jul 15, 2012
@loveshell loveshell reopened this Jul 15, 2012
@yaoweibin
Owner
@yezhifei

It is impossible to use virtual host for pure TCP server.
nginx's reverse proxy on multiple HTTP virtual host is based on the "Host" field in HTTP protocol.
But in TCP's protocol header, there's no such a thing.

The only way to hold multiple virtual server on the same IP and same port is to add some tag info in the TCP body.
But this solution reqires both server and client to be specialized on dealing with the tag.

@loveshell

是啊,楼上正解

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment