通过自定义域名访问部署于内网的 web 服务,由于有多个网站不在同一端口,如80和82,请问如何转发?是在vhost_http_port填写两个端口吗
多个域名嘛。
上域名管理网站配置好 *.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 这里写要配置的三级域名前缀
[web2] []内随意填写,会出现在log内,多个不能重复
type = http
local_ip = 127.0.0.1
local_port = 81
subdomain = back 这里写要配置的三级域名前缀
如果转发的http服务在多个机器,依样修改对应的local_port和subdomain
然后即可用http:/front .frp.xxx.com:50080/ 访问web1
http:/back.frp.xxx.com:50080/ 访问web2
按照你此方法出现以下问题
new proxy [web1] error: type [http] not support when vhost_http_port is not set
[service.go:172] Accept new mux stream error: broken pipe
type [http] not support when vhost_http_port is not set
很明显啊,你的frps.ini里面没设置vhost_http_port...
有个问题,我在老毛子路由器固件里这样设置
[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
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
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端口了,请问怎么解决
上域名管理网站配置好 *.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
好用,非常感谢
Most helpful comment
上域名管理网站配置好 *.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