欢迎来到好人卡资源网,专注网络技术资源收集,我们不仅是网络资源的搬运工,也生产原创资源。寻找资源请留言或关注公众号:烈日下的男人

Nginx 反向代理 cf 报错 502 解决方案

linux sky995 4年前 (2020-06-09) 3266次浏览 0个评论

本文及资源最后更新时间 2020-06-09 by sky995

Nginx 反向代理 Cloudflare 报错 502 教程

在尝试使用 Nginx 反向代理使用了 Cloudflare 的站点时,报错 502 Bad Gateway,Nginx 的设置很简单,差不多就如下

proxy_pass https://CloudflareIP;
proxy_set_header Host $host;

奇怪的是,这样的配置对大部分网站都没问题,只有 Cloudflare 会报错。于是,查看 Nginx 日志,发现如下错误:

SSL_do_handshake() failed (SSL: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:SSL alert number 40) while SSL handshaking to upstream

一番搜索后,有了办法,只需要在之前的基础上添加如下设置:

proxy_ssl_server_name on;

via.https://www.zhiin.net/YwWQ4TWGHX/

 

参考:

https://stackoverflow.com/questions/38375588/nginx-reverse-proxy-to-heroku-fails-ssl-handshake

https://stackoverflow.com/questions/25329941/nginx-caching-proxy-fails-with-ssl23-get-server-hellosslv3-alert-handshake-fail/25330027#25330027

https://community.cloudflare.com/t/reverse-proxy-infront-of-cloudflare/33972

https://github.com/alibaba/tengine/issues/1014

 

https://stackoverflow.com/questions/38931468/nginx-reverse-proxy-error14077438ssl-ssl-do-handshake-failed

 

终结方法 搞了半天只需要一句最关键的 proxy_ssl_server_name on; 就行了。


好人卡资源网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Nginx 反向代理 cf 报错 502 解决方案
喜欢 (2)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址