有人配置成功过 nginx 反代 frp 的 https 嘛?

2017 年 7 月 27 日
 wxlg1117
我怎么配置打开都是报 502 错误,frps 显示下面这个错误:
[vhost.go:131] get hostname from http/https request error: Unknow error...


PS:nginx 反代 frp 的 http 是没问题的
12206 次点击
所在节点    问与答
13 条回复
hteen
2017 年 7 月 27 日
我是 nginx frp 走 http, nginx 对外用的 https
oh
2017 年 7 月 27 日
把 https 加在 nginx 层,frp 用 http 呢?
oott123
2017 年 7 月 27 日
proxy_header Host $http_host;
oott123
2017 年 7 月 27 日
proxy_set_header,刚刚打错了
wxlg1117
2017 年 7 月 27 日
@oh 这个也没问题的
Showfom
2017 年 7 月 28 日
弱弱的问下 frp 是神马
wxlg1117
2017 年 7 月 28 日
设置过这个,也还是出错的
lcl1995225
2018 年 7 月 26 日
@wxlg1117 您好,这个问题解决了吗……我也遇到了这个问题,按照网上的教程试了“ ngx_http_proxy_connect_module ” 还是无解。
sf1991
2018 年 8 月 9 日
我解决这个问题了:

[NGINX HTTPS and FRPS · Issue #610 · fatedier/frp]( https://github.com/fatedier/frp/issues/610)

[nginx https 转发 frps · Issue #671 · fatedier/frp]( https://github.com/fatedier/frp/issues/671)

你先参考这两个。

我的代理:

```
server {
listen 80;
listen 443 ssl http2;

ssl_certificate /usr/local/nginx/conf/ssl/x.xxx.cn.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/x.xxx.cn.key;

server_name x.xxx.cn;

location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_ssl_server_name on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#看来这里要写死域名才行啊
proxy_pass https://x.xxx.cn:8080;
}
}
```

我这是为了解决:80 的 http/https 代理到 8080 的 http/https 上去,为了实现隐藏 8080 端口,因为 frp 绑定不论 80 端口,被占用了,所以 frp 只能使用 8080,而我这个代理就是为了隐藏 8080。

tip: 如果只是 http 的代理很容易,但是当我是 https 时,一样的 nginx 代理配置,frp 就不行了,虽然还没有找到真正的问题,但以上 nginx 代理配置也解决了我目前的问题。更多参见:[反向代理 · web 开发最佳实践 · 看云]( https://www.kancloud.cn/xiak/web-dev-best-practice/708208) #https 时的代理
darkt
2018 年 11 月 28 日
@sf1991 你好 问下 我现在部署了 frp 占用了 80 和 443 端口
现在想要实现 frp 里面绑定的泛域名 自动加 SSL 证书
现在是要安装 nginx 然后配置文件该怎么写呢 80 和 443 端口被占用 NGINX 肯定要换端口了
raymondzhou
2019 年 2 月 12 日
@darkt 我成功实现了 frp 和 nginx 共存,nginx 反向代理 frp 并实现全程 https
具体方法见这个链接
https://blog.ray8.cc/archives/nginx-frp-https-wildcard.html
AllenHua
2019 年 12 月 23 日
@raymondzhou #11 层主... 可不可以加个联系方式 交流学习下
AllenHua
2020 年 9 月 8 日
前几天弄了下 成功了 同 1 楼 frp 走 http, nginx 包裹一层 ssl

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/378393

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX