[GH-ISSUE #2052] 后续能支持端口映射的web服务吗 #1634

Closed
opened 2026-05-05 13:02:42 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @YukangLiu on GitHub (Nov 5, 2020).
Original GitHub issue: https://github.com/fatedier/frp/issues/2052

Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly.

Use the commands below to provide key information from your environment:
You do NOT have to include this information if this is a FEATURE REQUEST

What version of frp are you using (./frpc -v or ./frps -v)?
./frpc -v0.34.1 or ./frps -v0.34.1

What operating system and processor architecture are you using (go env)?

Configures you used:

Steps to reproduce the issue:
1.
2.
3.

Describe the results you received:

Describe the results you expected:
当前版本
通过自定义域名访问内网的 Web 服务,需要如下配置
修改 frps.ini 文件:
[common]
bind_port = 7000
vhost_http_port = 8080

修改 frpc.ini 文件:
[common]
server_addr = x.x.x.x
server_port = 7000

[web]
type = http
local_port = 80
custom_domains = www.yourdomain.com

[web2]
type = http
local_port = 8080
custom_domains = www.yourdomain2.com

这种方式本质上是用域名作为了端口号的id,使用起来很不方便。

期望版本
通过自定义域名访问内网的 Web 服务,需要如下配置
修改 frps.ini 文件:
[common]
bind_port = 7000
vhost_http_port = 8080 : 80
vhost_http_port2 = 7777: 8888

修改 frpc.ini 文件:
[common]
server_addr = x.x.x.x
server_port = 7000

这种方式意思是在服务端做了端口映射,当一个端口7777的http请求来到服务端,会将该请求包装,加上目标端口8888,并发给客户端,客户端将请求转发给目标端口,获得request再转发给用户。

Additional information you deem important (e.g. issue happens only occasionally):

Can you point out what caused this issue (optional)

Originally created by @YukangLiu on GitHub (Nov 5, 2020). Original GitHub issue: https://github.com/fatedier/frp/issues/2052 Issue is only used for submiting bug report and documents typo. If there are same issues or answers can be found in documents, we will close it directly. Use the commands below to provide key information from your environment: You do NOT have to include this information if this is a FEATURE REQUEST **What version of frp are you using (./frpc -v or ./frps -v)?** ./frpc -v0.34.1 or ./frps -v0.34.1 **What operating system and processor architecture are you using (`go env`)?** **Configures you used:** **Steps to reproduce the issue:** 1. 2. 3. **Describe the results you received:** **Describe the results you expected:** **当前版本**: 通过自定义域名访问内网的 Web 服务,需要如下配置 修改 frps.ini 文件: [common] bind_port = 7000 vhost_http_port = 8080 修改 frpc.ini 文件: [common] server_addr = x.x.x.x server_port = 7000 [web] type = http local_port = 80 custom_domains = www.yourdomain.com [web2] type = http local_port = 8080 custom_domains = www.yourdomain2.com 这种方式本质上是用域名作为了端口号的id,使用起来很不方便。 **期望版本**: 通过自定义域名访问内网的 Web 服务,需要如下配置 修改 frps.ini 文件: [common] bind_port = 7000 vhost_http_port = 8080 : 80 vhost_http_port2 = 7777: 8888 修改 frpc.ini 文件: [common] server_addr = x.x.x.x server_port = 7000 这种方式意思是在服务端做了端口映射,当一个端口7777的http请求来到服务端,会将该请求包装,加上目标端口8888,并发给客户端,客户端将请求转发给目标端口,获得request再转发给用户。 **Additional information you deem important (e.g. issue happens only occasionally):** **Can you point out what caused this issue (optional)**
Author
Owner

@Becods commented on GitHub (Nov 5, 2020):

端口转发?这种事用防火墙解决就行了
或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可
如果是最简单的穿透到内网的不同端口,使用tcp即可,参考Access your computer in LAN by SSH

<!-- gh-comment-id:722284912 --> @Becods commented on GitHub (Nov 5, 2020): 端口转发?这种事用防火墙解决就行了 或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可 如果是最简单的穿透到内网的不同端口,使用tcp即可,参考[Access your computer in LAN by SSH](https://github.com/fatedier/frp/#access-your-computer-in-lan-by-ssh)
Author
Owner

@YukangLiu commented on GitHub (Nov 6, 2020):

端口转发?这种事用防火墙解决就行了
或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可
如果是最简单的穿透到内网的不同端口,使用tcp即可,参考Access your computer in LAN by SSH

我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上.

<!-- gh-comment-id:722736792 --> @YukangLiu commented on GitHub (Nov 6, 2020): > 端口转发?这种事用防火墙解决就行了 > 或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可 > 如果是最简单的穿透到内网的不同端口,使用tcp即可,参考[Access your computer in LAN by SSH](https://github.com/fatedier/frp/#access-your-computer-in-lan-by-ssh) 我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上.
Author
Owner

@shenlijun commented on GitHub (Nov 6, 2020):

端口转发?这种事用防火墙解决就行了
或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可
如果是最简单的穿透到内网的不同端口,使用tcp即可,参考Access your computer in LAN by SSH

我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上.

现在就可以,不用http,用tcp对应不同的端口,nginx反向代理,都可以隐藏端口号直接用路径

<!-- gh-comment-id:722870109 --> @shenlijun commented on GitHub (Nov 6, 2020): > > 端口转发?这种事用防火墙解决就行了 > > 或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可 > > 如果是最简单的穿透到内网的不同端口,使用tcp即可,参考[Access your computer in LAN by SSH](https://github.com/fatedier/frp/#access-your-computer-in-lan-by-ssh) > > 我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上. 现在就可以,不用http,用tcp对应不同的端口,nginx反向代理,都可以隐藏端口号直接用路径
Author
Owner

@shenlijun commented on GitHub (Nov 6, 2020):

一个能用到例子
https://docs.gitea.io/zh-cn/reverse-proxies/

<!-- gh-comment-id:722874050 --> @shenlijun commented on GitHub (Nov 6, 2020): 一个能用到例子 https://docs.gitea.io/zh-cn/reverse-proxies/
Author
Owner

@YukangLiu commented on GitHub (Nov 6, 2020):

端口转发?这种事用防火墙解决就行了
或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可
如果是最简单的穿透到内网的不同端口,使用tcp即可,参考Access your computer in LAN by SSH

我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上.

现在就可以,不用http,用tcp对应不同的端口,nginx反向代理,都可以隐藏端口号直接用路径

懂了,谢谢!tcp+nginx完美解决

<!-- gh-comment-id:723130961 --> @YukangLiu commented on GitHub (Nov 6, 2020): > > > 端口转发?这种事用防火墙解决就行了 > > > 或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可 > > > 如果是最简单的穿透到内网的不同端口,使用tcp即可,参考[Access your computer in LAN by SSH](https://github.com/fatedier/frp/#access-your-computer-in-lan-by-ssh) > > > > > > 我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上. > > 现在就可以,不用http,用tcp对应不同的端口,nginx反向代理,都可以隐藏端口号直接用路径 懂了,谢谢!tcp+nginx完美解决
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#1634
No description provided.