fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
86.39k stars 13.36k forks source link

frps bind_port 是否可以通过nginx 443来转发连接流量 #3897

Closed ansonken closed 9 months ago

ansonken commented 10 months ago

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

xqzr commented 10 months ago

Nginx stream 模块

ansonken commented 10 months ago

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;
        }
xqzr commented 10 months ago

location 它在 http 模块 里的 server 块

github-actions[bot] commented 9 months ago

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