mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #2052] 后续能支持端口映射的web服务吗 #1634
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#1634
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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)
@Becods commented on GitHub (Nov 5, 2020):
端口转发?这种事用防火墙解决就行了
或者是说端口限制指定域名访问?这种只需frps加个nginx反代即可
如果是最简单的穿透到内网的不同端口,使用tcp即可,参考Access your computer in LAN by SSH
@YukangLiu commented on GitHub (Nov 6, 2020):
我的意思是~在内网我部署多个web服务,它们的端口号不同,现在frp实现的方法是配置用多个域名。但是申请多个域名是很麻烦的,可以直接来一个端口映射,比如服务端端口8888映射到客户端7777,服务端端口5555映射到客户端6666,这样我访问x.x.x.x:8888实际请求会被转发到内网:7777上,访问x.x.x.x:5555实际请求会被转发到内网:6666上.
@shenlijun commented on GitHub (Nov 6, 2020):
现在就可以,不用http,用tcp对应不同的端口,nginx反向代理,都可以隐藏端口号直接用路径
@shenlijun commented on GitHub (Nov 6, 2020):
一个能用到例子
https://docs.gitea.io/zh-cn/reverse-proxies/
@YukangLiu commented on GitHub (Nov 6, 2020):
懂了,谢谢!tcp+nginx完美解决