[GH-ISSUE #4130] 没有域名只有公网ip怎么访问内网web服务 #3260

Closed
opened 2026-05-05 14:06:14 -06:00 by gitea-mirror · 18 comments
Owner

Originally created by @mundane799699 on GitHub (Apr 7, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/4130

Bug Description

没有域名只有公网ip怎么访问内网web服务?我翻了一下之前的issue好像说是可以的,但是我自己没成功。我在本地windows用nginx起了一个80端口的服务,就是默认的那个页面。然后访问公网ip:6000,显示无法访问此网站。阿里云的安全组6000端口和7000端口已打开,firewall防火墙的6000端口和7000端口也已经打开。

frpc Version

0.56.0

frps Version

0.56.0

System Architecture

server端linux/amd64,客户端windows

Configurations

frps.toml

bindPort = 7000
vhostHTTPPort = 6000

frpc.toml

serverAddr = "47.103.60.169"
serverPort = 7000

[[proxies]]
name = "web"
type = "http"
localPort = 80
customDomains = ["47.103.60.169"]

Logs

frps:

2024-04-07 23:03:27.009 [I] [frps/root.go:105] frps uses config file: frps.toml
2024-04-07 23:03:27.186 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000
2024-04-07 23:03:27.186 [I] [server/service.go:304] http service listen on 0.0.0.0:6000
2024-04-07 23:03:27.186 [I] [frps/root.go:114] frps started successfully
2024-04-07 23:03:35.869 [I] [server/service.go:575] [04a618d62d4c0b6c] client login info: ip [183.128.64.197:8723] version [0.56.0] hostname [] os [windows] arch [amd64]
2024-04-07 23:03:35.888 [I] [proxy/http.go:110] [04a618d62d4c0b6c] [web] http proxy listen for host [47.103.60.169] location [] group [], routeByHTTPUser []
2024-04-07 23:03:35.888 [I] [server/control.go:401] [04a618d62d4c0b6c] new proxy [web] type [http] success

frpc:

PS C:\Users\79969\Desktop\frp_0.56.0_windows_amd64> ./frpc -c frpc.toml
2024-04-07 23:03:36.228 [I] [sub/root.go:142] start frpc service for config file [frpc.toml]
2024-04-07 23:03:36.295 [I] [client/service.go:294] try to connect to server...
2024-04-07 23:03:36.347 [I] [client/service.go:286] [04a618d62d4c0b6c] login to server success, get run id [04a618d62d4c0b6c]
2024-04-07 23:03:36.349 [I] [proxy/proxy_manager.go:173] [04a618d62d4c0b6c] proxy added: [web]
2024-04-07 23:03:36.365 [I] [client/control.go:170] [04a618d62d4c0b6c] [web] start proxy success

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @mundane799699 on GitHub (Apr 7, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/4130 ### Bug Description 没有域名只有公网ip怎么访问内网web服务?我翻了一下之前的issue好像说是可以的,但是我自己没成功。我在本地windows用nginx起了一个80端口的服务,就是默认的那个页面。然后访问公网ip:6000,显示无法访问此网站。阿里云的安全组6000端口和7000端口已打开,firewall防火墙的6000端口和7000端口也已经打开。 ### frpc Version 0.56.0 ### frps Version 0.56.0 ### System Architecture server端linux/amd64,客户端windows ### Configurations frps.toml ``` bindPort = 7000 vhostHTTPPort = 6000 ``` frpc.toml ``` serverAddr = "47.103.60.169" serverPort = 7000 [[proxies]] name = "web" type = "http" localPort = 80 customDomains = ["47.103.60.169"] ``` ### Logs frps: ``` 2024-04-07 23:03:27.009 [I] [frps/root.go:105] frps uses config file: frps.toml 2024-04-07 23:03:27.186 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000 2024-04-07 23:03:27.186 [I] [server/service.go:304] http service listen on 0.0.0.0:6000 2024-04-07 23:03:27.186 [I] [frps/root.go:114] frps started successfully 2024-04-07 23:03:35.869 [I] [server/service.go:575] [04a618d62d4c0b6c] client login info: ip [183.128.64.197:8723] version [0.56.0] hostname [] os [windows] arch [amd64] 2024-04-07 23:03:35.888 [I] [proxy/http.go:110] [04a618d62d4c0b6c] [web] http proxy listen for host [47.103.60.169] location [] group [], routeByHTTPUser [] 2024-04-07 23:03:35.888 [I] [server/control.go:401] [04a618d62d4c0b6c] new proxy [web] type [http] success ``` frpc: ``` PS C:\Users\79969\Desktop\frp_0.56.0_windows_amd64> ./frpc -c frpc.toml 2024-04-07 23:03:36.228 [I] [sub/root.go:142] start frpc service for config file [frpc.toml] 2024-04-07 23:03:36.295 [I] [client/service.go:294] try to connect to server... 2024-04-07 23:03:36.347 [I] [client/service.go:286] [04a618d62d4c0b6c] login to server success, get run id [04a618d62d4c0b6c] 2024-04-07 23:03:36.349 [I] [proxy/proxy_manager.go:173] [04a618d62d4c0b6c] proxy added: [web] 2024-04-07 23:03:36.365 [I] [client/control.go:170] [04a618d62d4c0b6c] [web] start proxy success ``` ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@Jandaes commented on GitHub (Apr 9, 2024):

我也没成功、也是http穿透!没有配置域名的话服务都启动不了

<!-- gh-comment-id:2044070559 --> @Jandaes commented on GitHub (Apr 9, 2024): 我也没成功、也是http穿透!没有配置域名的话服务都启动不了
Author
Owner

@mundane799699 commented on GitHub (Apr 9, 2024):

我也没成功、也是http穿透!没有配置域名的话服务都启动不了

我服务是能启动的

<!-- gh-comment-id:2045207691 --> @mundane799699 commented on GitHub (Apr 9, 2024): > 我也没成功、也是http穿透!没有配置域名的话服务都启动不了 我服务是能启动的
Author
Owner

@peace4j commented on GitHub (Apr 10, 2024):

没有域名的情况下,使用tcp proxy来代理就可以了,把你的内网的http服务当成一个标准的tcp应用来配置。

<!-- gh-comment-id:2046282878 --> @peace4j commented on GitHub (Apr 10, 2024): 没有域名的情况下,使用tcp proxy来代理就可以了,把你的内网的http服务当成一个标准的tcp应用来配置。
Author
Owner

@Jandaes commented on GitHub (Apr 10, 2024):

没有域名的情况下,使用tcp proxy来代理就可以了,把你的内网的http服务当成一个标准的tcp应用来配置。

多谢、我改成tcp了的确就可以了、这样也可以配多个了

<!-- gh-comment-id:2046708841 --> @Jandaes commented on GitHub (Apr 10, 2024): > 没有域名的情况下,使用tcp proxy来代理就可以了,把你的内网的http服务当成一个标准的tcp应用来配置。 多谢、我改成tcp了的确就可以了、这样也可以配多个了
Author
Owner

@mundane799699 commented on GitHub (Apr 17, 2024):

没有域名的情况下,使用tcp proxy来代理就可以了,把你的内网的http服务当成一个标准的tcp应用来配置。

@fatedier 你好,我测试了一下。tcp代理,如果是用6000端口就会失败,换6001或者6002等端口就能成功。应该是个bug。比如像这样的就会失败。

serverAddr = "47.103.60.169"
serverPort = 7000

[[proxies]]
name = "test-tcp"
type = "tcp"
localIP = "127.0.0.1"
localPort = 80
remotePort = 6000
<!-- gh-comment-id:2060856398 --> @mundane799699 commented on GitHub (Apr 17, 2024): > 没有域名的情况下,使用tcp proxy来代理就可以了,把你的内网的http服务当成一个标准的tcp应用来配置。 @fatedier 你好,我测试了一下。tcp代理,如果是用6000端口就会失败,换6001或者6002等端口就能成功。应该是个bug。比如像这样的就会失败。 ``` serverAddr = "47.103.60.169" serverPort = 7000 [[proxies]] name = "test-tcp" type = "tcp" localIP = "127.0.0.1" localPort = 80 remotePort = 6000 ```
Author
Owner

@wjx0428 commented on GitHub (Apr 24, 2024):

你好解决了吗?

<!-- gh-comment-id:2074856156 --> @wjx0428 commented on GitHub (Apr 24, 2024): 你好解决了吗?
Author
Owner

@mundane799699 commented on GitHub (Apr 24, 2024):

你好解决了吗?

解决了,端口不能用6000

<!-- gh-comment-id:2074877605 --> @mundane799699 commented on GitHub (Apr 24, 2024): > 你好解决了吗? 解决了,端口不能用6000
Author
Owner

@mundane799699 commented on GitHub (Apr 24, 2024):

端口不能用6000

<!-- gh-comment-id:2074878933 --> @mundane799699 commented on GitHub (Apr 24, 2024): 端口不能用6000
Author
Owner

@TimerChen commented on GitHub (Apr 26, 2024):

因为你设置了vhostHTTPPort,两个端口重复了

端口不能用6000

<!-- gh-comment-id:2079329373 --> @TimerChen commented on GitHub (Apr 26, 2024): 因为你设置了vhostHTTPPort,两个端口重复了 > 端口不能用6000
Author
Owner

@mundane799699 commented on GitHub (Apr 26, 2024):

因为你设置了vhostHTTPPort,两个端口重复了

端口不能用6000

并不是,我改成6001就可以,6000就是不行

<!-- gh-comment-id:2079348155 --> @mundane799699 commented on GitHub (Apr 26, 2024): > 因为你设置了vhostHTTPPort,两个端口重复了 > > > 端口不能用6000 并不是,我改成6001就可以,6000就是不行
Author
Owner

@wk989898 commented on GitHub (May 31, 2024):

端口不能用6000

6000是非安全端口,使用chrome无法访问。

<!-- gh-comment-id:2141794677 --> @wk989898 commented on GitHub (May 31, 2024): > 端口不能用6000 6000是非安全端口,使用chrome无法访问。
Author
Owner

@Jandaes commented on GitHub (May 31, 2024):

收到、谢谢!祝好

<!-- gh-comment-id:2141795571 --> @Jandaes commented on GitHub (May 31, 2024): 收到、谢谢!祝好
Author
Owner

@aCoo4ie commented on GitHub (Aug 30, 2024):

端口不能用6000

6000是非安全端口,使用chrome无法访问。

其他浏览器也访问不了!

<!-- gh-comment-id:2319691197 --> @aCoo4ie commented on GitHub (Aug 30, 2024): > > 端口不能用6000 > > 6000是非安全端口,使用chrome无法访问。 其他浏览器也访问不了!
Author
Owner

@aCoo4ie commented on GitHub (Aug 30, 2024):

因为你设置了vhostHTTPPort,两个端口重复了

端口不能用6000

并不是,我改成6001就可以,6000就是不行

对,我也复现了,在0.60的最新版中也是这样的!

<!-- gh-comment-id:2319692207 --> @aCoo4ie commented on GitHub (Aug 30, 2024): > > 因为你设置了vhostHTTPPort,两个端口重复了 > > > 端口不能用6000 > > 并不是,我改成6001就可以,6000就是不行 对,我也复现了,在0.60的最新版中也是这样的!
Author
Owner

@Mr-wangwei commented on GitHub (Nov 17, 2024):

本地必须80端口才可以吗?

<!-- gh-comment-id:2481149606 --> @Mr-wangwei commented on GitHub (Nov 17, 2024): 本地必须80端口才可以吗?
Author
Owner

@shaunhurryup commented on GitHub (Jan 3, 2025):

我也没成功、也是http穿透!没有配置域名的话服务都启动不了

起不来是因为 frps 把 port 占了,frpc 连不上。

  1. 注释掉 frps 的 # vhostHTTPPort = 8080 这行
bindPort = 7000
# vhostHTTPPort = 8000
  1. 在 frpc 加上 remotePort = 8080
[[proxies]]
name = "node-service"
type = "tcp"
localPort = 3000
localIP = "127.0.0.1"
remotePort = 8080

我这样是成功的

<!-- gh-comment-id:2569152755 --> @shaunhurryup commented on GitHub (Jan 3, 2025): > 我也没成功、也是http穿透!没有配置域名的话服务都启动不了 起不来是因为 frps 把 port 占了,frpc 连不上。 1. 注释掉 frps 的 `# vhostHTTPPort = 8080` 这行 ```toml bindPort = 7000 # vhostHTTPPort = 8000 ``` 2. 在 frpc 加上 `remotePort = 8080` ```toml [[proxies]] name = "node-service" type = "tcp" localPort = 3000 localIP = "127.0.0.1" remotePort = 8080 ``` 我这样是成功的
Author
Owner

@caoxiangqian commented on GitHub (Feb 27, 2026):

换成了一个大于10000的端口成功了

<!-- gh-comment-id:3973345010 --> @caoxiangqian commented on GitHub (Feb 27, 2026): 换成了一个大于10000的端口成功了
Author
Owner

@Jandaes commented on GitHub (Feb 27, 2026):

收到、谢谢!祝好

<!-- gh-comment-id:3973347820 --> @Jandaes commented on GitHub (Feb 27, 2026): 收到、谢谢!祝好
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#3260
No description provided.