Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于端口转发的问题 #1

Closed
WuYunlong opened this issue Dec 31, 2016 · 4 comments
Closed

关于端口转发的问题 #1

WuYunlong opened this issue Dec 31, 2016 · 4 comments

Comments

@WuYunlong
Copy link

WuYunlong commented Dec 31, 2016

# 如果服务端启动命令为
socket-pipe -l 10080 -r 80 -t hserver -s ng

# 客户端启动命令为
socket-pipe -l 80 -r 123.123.123.123@10080 -t hclient -s ng

此时一切正常, 我可以通过访问 ng.domain.com 访问本机

# 修改服务端命令
socket-pipe -l 10080 -r 8080 -t hserver -s ng

客户端启动命令为
socket-pipe -l 80 -r 123.123.123.123@10080 -t hclient -s ng

此时访问ng.domain.com出错,
访问 ng.domain.com:8080 正常 可以访问本机

请问能否做到服务端代理的端口为8080 但是可以直接通过 ng.domain.com 访问本机的80端口

我现在的操作是 用了nginx 做代理

upstream ng {
    server 127.0.0.1:8080;
    keepalive 64;
}
server {
    listen 80;
    server_name *.domain.com;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host:80;
        proxy_set_header X-Nginx-Proxy true;
        proxy_set_header Connection "";
        proxy_pass http://ng;
    }
}
@joyqi
Copy link
Owner

joyqi commented Jan 1, 2017

看到你已经关闭了issue,补充一下,如果你要直接通过域名且隐藏端口号访问一个地址,那么只有一种情况能满足,即这个地址的端口号是80

@WuYunlong
Copy link
Author

WuYunlong commented Jan 2, 2017 via email

@joyqi
Copy link
Owner

joyqi commented Jan 3, 2017

参数这个倒是很好加,流量统计这种需求太小众了,可能暂时不会开发

@WuYunlong
Copy link
Author

WuYunlong commented Jan 3, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants