[GH-ISSUE #3897] frps bind_port 是否可以通过nginx 443来转发连接流量 #3090

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

Originally created by @ansonken on GitHub (Dec 26, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3897

Describe the feature request

环境:
1、公网服务器:安装了nginx 和frps ,公网服务器的安全组只放通443端口;
2、内网服务器: 需求发布https业务,服务器安装了frpc;
需求场景:希望公网服务器只暴露443端口,内网的frpc 连接公网服务器 frps bind_port 端口的时候,连接流量走443端口转发到frps的7000端口。

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @ansonken on GitHub (Dec 26, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3897 ### Describe the feature request 环境: 1、公网服务器:安装了nginx 和frps ,公网服务器的安全组只放通443端口; 2、内网服务器: 需求发布https业务,服务器安装了frpc; 需求场景:希望公网服务器只暴露443端口,内网的frpc 连接公网服务器 frps bind_port 端口的时候,连接流量走443端口转发到frps的7000端口。 ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:59:59 -06:00
Author
Owner

@xqzr commented on GitHub (Dec 26, 2023):

Nginx stream 模块

<!-- gh-comment-id:1869446152 --> @xqzr commented on GitHub (Dec 26, 2023): Nginx stream 模块
Author
Owner

@ansonken commented on GitHub (Dec 27, 2023):

stream {
upstream frp {
server x.x.x.x:7000; # 您的FRPS服务器IP地址和bind_port
}

server {
    listen 443;
    proxy_pass frp;
}

}

我现在的宝塔面板nginx 配置一些website 用来通过443端口转发流量,来做梯子,还有配置了一些website 通过443端口来访问家里的nas;
在主配置文件启用了上面的配置后,NGINX 就起不来了,好像是端口冲突了。
如果删除了所有website ,按照上面代码配置,frps 是可以正常使用。
梯子website 配置文件:
location ^~ /data3838
{
proxy_redirect off;
proxy_pass http://127.0.0.1:21737;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;

        # Show realip in v2ray access.log
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot")
		{
			return 403;
		}
<!-- gh-comment-id:1870076332 --> @ansonken commented on GitHub (Dec 27, 2023): stream { upstream frp { server x.x.x.x:7000; # 您的FRPS服务器IP地址和bind_port } server { listen 443; proxy_pass frp; } } 我现在的宝塔面板nginx 配置一些website 用来通过443端口转发流量,来做梯子,还有配置了一些website 通过443端口来访问家里的nas; 在主配置文件启用了上面的配置后,NGINX 就起不来了,好像是端口冲突了。 如果删除了所有website ,按照上面代码配置,frps 是可以正常使用。 梯子website 配置文件: location ^~ /data3838 { proxy_redirect off; proxy_pass http://127.0.0.1:21737; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $http_host; # Show realip in v2ray access.log proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot") { return 403; }
Author
Owner

@xqzr commented on GitHub (Dec 27, 2023):

location 它在 http 模块 里的 server 块

<!-- gh-comment-id:1870265620 --> @xqzr commented on GitHub (Dec 27, 2023): `location` 它在 http 模块 里的 server 块
Author
Owner

@github-actions[bot] commented on GitHub (Jan 25, 2024):

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

<!-- gh-comment-id:1909292057 --> @github-actions[bot] commented on GitHub (Jan 25, 2024): Issues go stale after 21d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
Author
Owner

@jsczrangel commented on GitHub (Dec 4, 2024):

成功了吗,7000端口可以被nginx代理哈

<!-- gh-comment-id:2516361864 --> @jsczrangel commented on GitHub (Dec 4, 2024): 成功了吗,7000端口可以被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#3090
No description provided.