惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
N
Netflix TechBlog - Medium
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
I
InfoQ
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
有赞技术团队
有赞技术团队
G
Google Developers Blog
L
LangChain Blog
博客园_首页
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
月光博客
月光博客
IT之家
IT之家
量子位
宝玉的分享
宝玉的分享
S
SegmentFault 最新的问题
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
雷峰网
雷峰网

九月的风

Cloudflare Workers 无服务器免费搭建探针监控项目「CF-Server-Monitor」 - 九月的风 OneXPlayer 飞行家F1Pro「新玩具」 - 九月的风 终不似,少年游「摩旅中国」 - 九月的风 SSHPASS 免交互 SCP 传输文件「备份」 - 九月的风 docker hub 自建镜像加速「可用」 - 九月的风 海尔随身WIFI MF761W 焊接SIM卡槽「打火机工艺」 - 九月的风 海尔随身WIFI F231ZC/M23L/761W 刷机去控教程 - 九月的风 「自作」Chrome_123.0.6312.123_64bit_Portable - 九月的风 Chrome 浏览器关闭左上角搜索标签页的解决办法 - 九月的风 「摘抄」Wordpress 网站性能优化指南(免插件) - 九月的风
「备份」Nginx 反代 Cloudflare 站点 - 九月的风
September · 2024-06-01 · via 九月的风

Nginx 在反代套用了 Cloudflare CDN 的网站时,会出现 502 错误。修复这一个错误只需要在 Nginx 反代配置中修改操作。

代码如下:

location /
{
proxy_pass https://xxx;
proxy_set_header Host xxx;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_ssl_name $http_host;
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2 TLSv1.3;
add_header X-Cache $upstream_cache_status;

#Set Nginx Cache

add_header Cache-Control no-cache;
}

#PROXY-END/

重要设置:
//Nginx SNI
proxy_ssl_name $http_host;
proxy_ssl_server_name on;
//指定 SSL 协议
proxy_ssl_protocols TLSv1.2 TLSv1.3;

互联网上的大部分教程只提了 SNI,自己测试之后还是反复 502,直到设置了指定 SSL 协议之后,成功反代 Cloudflare CDN 站点!

搜索了很多相关的教程资料,有很大一部分超过 99% 的教程都没有提及要指定 SSL 协议,走了不少弯路,特此记录一下备忘!