[GH-ISSUE #3911] 请教一下使用Nginx作为frps前置代理的配置 #3102

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

Originally created by @heqiaomu on GitHub (Jan 5, 2024).
Original GitHub issue: https://github.com/fatedier/frp/issues/3911

Bug Description

在 nginx 的配置中,我配置的是:

    location /application  {  
        proxy_pass http://172.23.161.143:30080;  
        proxy_set_header Host $host;
    } 

我的服务端的配置是:

bindAddr = "0.0.0.0"
bindPort = 7011

vhostHTTPPort = 30080
vhostHTTPSPort = 30443

webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin"

auth.method = "token"
auth.token = ""

然后我的客户端:

user = "heqiaomu"

serverAddr = "x.x.x.x"
serverPort = 7011
auth.method = "token"
auth.token = ""

[[proxies]]
name = "confluence"
type = "http"
localPort = 8090
customDomains = ["www.heqiaomu123.cn"]
locations = ["/application/wiki"]

然后我在访问 www.heqiaomu123.cn/application/wiki 我的路由会直接跳到 http://www.heqiaomu123.cn/login.action。理论上应该是到 www.heqiaomu123.cn/application/wiki/login.action 这个地址。我想请问下这块有相关的配置上的参考吗?

frpc Version

0.53.2

frps Version

0.53.2

System Architecture

linux/amd64

Configurations

在 nginx 的配置中,我配置的是:

    location /application  {  
        proxy_pass http://172.23.161.143:30080;  
        proxy_set_header Host $host;
    } 

我的服务端的配置是:

bindAddr = "0.0.0.0"
bindPort = 7011

vhostHTTPPort = 30080
vhostHTTPSPort = 30443

webServer.addr = "0.0.0.0"
webServer.port = 7500
webServer.user = "admin"
webServer.password = "admin"

auth.method = "token"
auth.token = ""

然后我的客户端:

user = "heqiaomu"

serverAddr = "x.x.x.x"
serverPort = 7011
auth.method = "token"
auth.token = ""

[[proxies]]
name = "confluence"
type = "http"
localPort = 8090
customDomains = ["www.heqiaomu123.cn"]
locations = ["/application/wiki"]

Logs

No response

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 @heqiaomu on GitHub (Jan 5, 2024). Original GitHub issue: https://github.com/fatedier/frp/issues/3911 ### Bug Description 在 nginx 的配置中,我配置的是: ```shell location /application { proxy_pass http://172.23.161.143:30080; proxy_set_header Host $host; } ``` 我的服务端的配置是: ```shell bindAddr = "0.0.0.0" bindPort = 7011 vhostHTTPPort = 30080 vhostHTTPSPort = 30443 webServer.addr = "0.0.0.0" webServer.port = 7500 webServer.user = "admin" webServer.password = "admin" auth.method = "token" auth.token = "" ``` 然后我的客户端: ```shell user = "heqiaomu" serverAddr = "x.x.x.x" serverPort = 7011 auth.method = "token" auth.token = "" [[proxies]] name = "confluence" type = "http" localPort = 8090 customDomains = ["www.heqiaomu123.cn"] locations = ["/application/wiki"] ``` 然后我在访问 www.heqiaomu123.cn/application/wiki 我的路由会直接跳到 http://www.heqiaomu123.cn/login.action。理论上应该是到 www.heqiaomu123.cn/application/wiki/login.action 这个地址。我想请问下这块有相关的配置上的参考吗? ### frpc Version 0.53.2 ### frps Version 0.53.2 ### System Architecture linux/amd64 ### Configurations 在 nginx 的配置中,我配置的是: ```shell location /application { proxy_pass http://172.23.161.143:30080; proxy_set_header Host $host; } ``` 我的服务端的配置是: ```shell bindAddr = "0.0.0.0" bindPort = 7011 vhostHTTPPort = 30080 vhostHTTPSPort = 30443 webServer.addr = "0.0.0.0" webServer.port = 7500 webServer.user = "admin" webServer.password = "admin" auth.method = "token" auth.token = "" ``` 然后我的客户端: ```shell user = "heqiaomu" serverAddr = "x.x.x.x" serverPort = 7011 auth.method = "token" auth.token = "" [[proxies]] name = "confluence" type = "http" localPort = 8090 customDomains = ["www.heqiaomu123.cn"] locations = ["/application/wiki"] ``` ### Logs _No response_ ### Steps to reproduce 1. 2. 3. ... ### Affected area - [X] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:00:33 -06:00
Author
Owner

@superzjg commented on GitHub (Jan 6, 2024):

那个客户端 localIP 是没有吗?

<!-- gh-comment-id:1879503813 --> @superzjg commented on GitHub (Jan 6, 2024): 那个客户端 `localIP` 是没有吗?
Author
Owner

@Fiary-Tale commented on GitHub (Jan 6, 2024):

兄弟,你试着把customDomains = ["1.1.1.1"]这个配置为customDomains = ["127.0.0.1"],就会默认转发到他的127.0.0.1:58880端口上,这样就可以做nginx反向代理了

<!-- gh-comment-id:1879724620 --> @Fiary-Tale commented on GitHub (Jan 6, 2024): 兄弟,你试着把customDomains = ["1.1.1.1"]这个配置为customDomains = ["127.0.0.1"],就会默认转发到他的127.0.0.1:58880端口上,这样就可以做nginx反向代理了
Author
Owner

@Fiary-Tale commented on GitHub (Jan 6, 2024):

frpc的配置改一下就可以

<!-- gh-comment-id:1879724687 --> @Fiary-Tale commented on GitHub (Jan 6, 2024): frpc的配置改一下就可以
Author
Owner

@heqiaomu commented on GitHub (Jan 16, 2024):

OKOK, 应该是我这边的代理问题导致的。

<!-- gh-comment-id:1893017895 --> @heqiaomu commented on GitHub (Jan 16, 2024): OKOK, 应该是我这边的代理问题导致的。
Author
Owner

@github-actions[bot] commented on GitHub (Feb 7, 2024):

Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1931022643 --> @github-actions[bot] commented on GitHub (Feb 7, 2024): Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
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#3102
No description provided.