[GH-ISSUE #365] 同一客户端能否转发多个端口 #265

Closed
opened 2026-05-05 12:04:16 -06:00 by gitea-mirror · 8 comments
Owner

Originally created by @liwenjie119 on GitHub (Jun 15, 2017).
Original GitHub issue: https://github.com/fatedier/frp/issues/365

通过自定义域名访问部署于内网的 web 服务,由于有多个网站不在同一端口,如80和82,请问如何转发?是在vhost_http_port填写两个端口吗

Originally created by @liwenjie119 on GitHub (Jun 15, 2017). Original GitHub issue: https://github.com/fatedier/frp/issues/365 通过自定义域名访问部署于内网的 web 服务,由于有多个网站不在同一端口,如80和82,请问如何转发?是在vhost_http_port填写两个端口吗
Author
Owner

@ChicBrother commented on GitHub (Jun 15, 2017):

多个域名嘛。

<!-- gh-comment-id:308607810 --> @ChicBrother commented on GitHub (Jun 15, 2017): 多个域名嘛。
Author
Owner

@wxlg1117 commented on GitHub (Jun 15, 2017):

上域名管理网站配置好 *.frp转发到frps服务器ip

多个子域名好用 👍
frps.ini里面配置上vhost_http_porty = 50080 (一个端口)
subdomain_host = frp.xxx.com
以及配置好privilege_token = 123456

然后frpc.ini里面配置web服务的时候:
几个主要配置必须写
privilege_token = 123456 特权模式连接frps
[web1] []内随意填写,会出现在log内,多个不能重复
type = http
local_ip = 127.0.0.1
local_port = 80
subdomain = front 这里写要配置的三级域名前缀
#custom_domains = frp.com 注意,这个选项必须注释掉

[web2] []内随意填写,会出现在log内,多个不能重复
type = http
local_ip = 127.0.0.1
local_port = 81
subdomain = back 这里写要配置的三级域名前缀
#custom_domains = frp.com 注意,这个选项必须注释掉

如果转发的http服务在多个机器,依样修改对应的local_port和subdomain
然后即可用http:/front .frp.xxx.com:50080/ 访问web1
http:/back.frp.xxx.com:50080/ 访问web2

<!-- gh-comment-id:308693756 --> @wxlg1117 commented on GitHub (Jun 15, 2017): 上域名管理网站配置好 *.frp转发到frps服务器ip 多个子域名好用 :+1: frps.ini里面配置上vhost_http_porty = 50080 (一个端口) subdomain_host = frp.xxx.com 以及配置好privilege_token = 123456 然后frpc.ini里面配置web服务的时候: 几个主要配置必须写 privilege_token = 123456 特权模式连接frps [web1] []内随意填写,会出现在log内,多个不能重复 type = http local_ip = 127.0.0.1 local_port = 80 subdomain = front 这里写要配置的三级域名前缀 #custom_domains = frp.com 注意,这个选项必须注释掉 [web2] []内随意填写,会出现在log内,多个不能重复 type = http local_ip = 127.0.0.1 local_port = 81 subdomain = back 这里写要配置的三级域名前缀 #custom_domains = frp.com 注意,这个选项必须注释掉 如果转发的http服务在多个机器,依样修改对应的local_port和subdomain 然后即可用http:/front .frp.xxx.com:50080/ 访问web1 http:/back.frp.xxx.com:50080/ 访问web2
Author
Owner

@liwenjie119 commented on GitHub (Jun 15, 2017):

按照你此方法出现以下问题
new proxy [web1] error: type [http] not support when vhost_http_port is not set

<!-- gh-comment-id:308706990 --> @liwenjie119 commented on GitHub (Jun 15, 2017): 按照你此方法出现以下问题 new proxy [web1] error: type [http] not support when vhost_http_port is not set
Author
Owner

@liwenjie119 commented on GitHub (Jun 15, 2017):

[service.go:172] Accept new mux stream error: broken pipe

<!-- gh-comment-id:308708593 --> @liwenjie119 commented on GitHub (Jun 15, 2017): [service.go:172] Accept new mux stream error: broken pipe
Author
Owner

@wxlg1117 commented on GitHub (Jun 15, 2017):

type [http] not support when vhost_http_port is not set

很明显啊,你的frps.ini里面没设置vhost_http_port...

<!-- gh-comment-id:308736660 --> @wxlg1117 commented on GitHub (Jun 15, 2017): type [http] not support when vhost_http_port is not set 很明显啊,你的frps.ini里面没设置vhost_http_port...
Author
Owner

@liwenjie119 commented on GitHub (Jun 18, 2017):

有个问题,我在老毛子路由器固件里这样设置
[common]
server_addr = my VPS IP
server_port = 7000
privilege_token = 123456
[web1]
privilege_mode = true
remote_port = 6000
type = http
local_ip = 192.168.31.1
local_port = 80
use_gzip = true
subdomain = web
#host_header_rewrite =
log_file = /dev/null
log_level = info
log_max_days = 3
[web2]
privilege_mode = true
remote_port = 6000
type = http
local_ip = my VPS IP
local_port = 82
use_gzip = true
subdomain = pan
#host_header_rewrite =
log_file = /dev/null
log_level = info
log_max_days = 3
服务端
[common]
vhost_http_porty = 7000
dashboard_port = 7500
vhost_http_port = 80
subdomain_host =frp.xxxx.cn
privilege_mode = true
privilege_token = 123456
max_pool_count = 50
log_file = ./frps1.log
log_level = info
log_max_days = 3
就在http://frp.xxxx.cn:7500/看到两个80端口,但 SubDomain一个是 pan.frp.xxxx.cn,另一个是 web.frp.xxxx.cn,然后就可以用web.frp.xxxx.cn直接访问,而pan.frp.xxxx.cn无法访问。
若在服务端设置加一句vhost_http_port = 82,就变成两个82端口了,请问怎么解决

<!-- gh-comment-id:309288065 --> @liwenjie119 commented on GitHub (Jun 18, 2017): 有个问题,我在老毛子路由器固件里这样设置 [common] server_addr = my VPS IP server_port = 7000 privilege_token = 123456 [web1] privilege_mode = true remote_port = 6000 type = http local_ip = 192.168.31.1 local_port = 80 use_gzip = true subdomain = web #host_header_rewrite = log_file = /dev/null log_level = info log_max_days = 3 [web2] privilege_mode = true remote_port = 6000 type = http local_ip = my VPS IP local_port = 82 use_gzip = true subdomain = pan #host_header_rewrite = log_file = /dev/null log_level = info log_max_days = 3 服务端 [common] vhost_http_porty = 7000 dashboard_port = 7500 vhost_http_port = 80 subdomain_host =frp.xxxx.cn privilege_mode = true privilege_token = 123456 max_pool_count = 50 log_file = ./frps1.log log_level = info log_max_days = 3 就在http://frp.xxxx.cn:7500/看到两个80端口,但 SubDomain一个是 pan.frp.xxxx.cn,另一个是 web.frp.xxxx.cn,然后就可以用web.frp.xxxx.cn直接访问,而pan.frp.xxxx.cn无法访问。 若在服务端设置加一句vhost_http_port = 82,就变成两个82端口了,请问怎么解决
Author
Owner

@wyyl1 commented on GitHub (May 11, 2020):

上域名管理网站配置好 *.frp转发到frps服务器ip

多个子域名好用 👍
frps.ini里面配置上vhost_http_porty = 50080 (一个端口)
subdomain_host = frp.xxx.com
以及配置好privilege_token = 123456

然后frpc.ini里面配置web服务的时候:
几个主要配置必须写
privilege_token = 123456 特权模式连接frps
[web1] []内随意填写,会出现在log内,多个不能重复
type = http
local_ip = 127.0.0.1
local_port = 80
subdomain = front 这里写要配置的三级域名前缀
#custom_domains = frp.com 注意,这个选项必须注释掉

[web2] []内随意填写,会出现在log内,多个不能重复
type = http
local_ip = 127.0.0.1
local_port = 81
subdomain = back 这里写要配置的三级域名前缀
#custom_domains = frp.com 注意,这个选项必须注释掉

如果转发的http服务在多个机器,依样修改对应的local_port和subdomain
然后即可用http:/front .frp.xxx.com:50080/ 访问web1
http:/back.frp.xxx.com:50080/ 访问web2

好用,非常感谢

<!-- gh-comment-id:626450397 --> @wyyl1 commented on GitHub (May 11, 2020): > 上域名管理网站配置好 *.frp转发到frps服务器ip > > 多个子域名好用 👍 > frps.ini里面配置上vhost_http_porty = 50080 (一个端口) > subdomain_host = frp.xxx.com > 以及配置好privilege_token = 123456 > > 然后frpc.ini里面配置web服务的时候: > 几个主要配置必须写 > privilege_token = 123456 特权模式连接frps > [web1] []内随意填写,会出现在log内,多个不能重复 > type = http > local_ip = 127.0.0.1 > local_port = 80 > subdomain = front 这里写要配置的三级域名前缀 > #custom_domains = frp.com 注意,这个选项必须注释掉 > > [web2] []内随意填写,会出现在log内,多个不能重复 > type = http > local_ip = 127.0.0.1 > local_port = 81 > subdomain = back 这里写要配置的三级域名前缀 > #custom_domains = frp.com 注意,这个选项必须注释掉 > > 如果转发的http服务在多个机器,依样修改对应的local_port和subdomain > 然后即可用http:/front .frp.xxx.com:50080/ 访问web1 > http:/back.frp.xxx.com:50080/ 访问web2 好用,非常感谢
Author
Owner

@tropicaljungle commented on GitHub (Feb 19, 2024):

上域名管理网站配置好 *.frp转发到frps服务器ip

多个子域名好用 👍 frps.ini里面配置上vhost_http_porty = 50080 (一个端口) subdomain_host = frp.xxx.com 以及配置好privilege_token = 123456

然后frpc.ini里面配置web服务的时候: 几个主要配置必须写 privilege_token = 123456 特权模式连接frps [web1] []内随意填写,会出现在log内,多个不能重复 type = http local_ip = 127.0.0.1 local_port = 80 subdomain = front 这里写要配置的三级域名前缀 #custom_domains = frp.com 注意,这个选项必须注释掉

[web2] []内随意填写,会出现在log内,多个不能重复 type = http local_ip = 127.0.0.1 local_port = 81 subdomain = back 这里写要配置的三级域名前缀 #custom_domains = frp.com 注意,这个选项必须注释掉

如果转发的http服务在多个机器,依样修改对应的local_port和subdomain 然后即可用http:/front .frp.xxx.com:50080/ 访问web1 http:/back.frp.xxx.com:50080/ 访问web2

这个思路优秀,回头试试看

<!-- gh-comment-id:1951788146 --> @tropicaljungle commented on GitHub (Feb 19, 2024): > 上域名管理网站配置好 *.frp转发到frps服务器ip > > 多个子域名好用 👍 frps.ini里面配置上vhost_http_porty = 50080 (一个端口) subdomain_host = frp.xxx.com 以及配置好privilege_token = 123456 > > 然后frpc.ini里面配置web服务的时候: 几个主要配置必须写 privilege_token = 123456 特权模式连接frps [web1] []内随意填写,会出现在log内,多个不能重复 type = http local_ip = 127.0.0.1 local_port = 80 subdomain = front 这里写要配置的三级域名前缀 #custom_domains = frp.com 注意,这个选项必须注释掉 > > [web2] []内随意填写,会出现在log内,多个不能重复 type = http local_ip = 127.0.0.1 local_port = 81 subdomain = back 这里写要配置的三级域名前缀 #custom_domains = frp.com 注意,这个选项必须注释掉 > > 如果转发的http服务在多个机器,依样修改对应的local_port和subdomain 然后即可用http:/front .frp.xxx.com:50080/ 访问web1 http:/back.frp.xxx.com:50080/ 访问web2 这个思路优秀,回头试试看
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#265
No description provided.