Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudflare 使用 SaaS 回源加速配置笔记 #95

Open
hanxi opened this issue Jan 4, 2025 · 0 comments
Open

Cloudflare 使用 SaaS 回源加速配置笔记 #95

hanxi opened this issue Jan 4, 2025 · 0 comments

Comments

@hanxi
Copy link
Owner

hanxi commented Jan 4, 2025

加速 Github Pages 域名

每加速一个回退源就消耗一个免费域名,加速 Github Pages 会消耗一个,即使有个多个 Github Pages 也只需要一个免费域名。

前置需求

  1. https://nic.us.kg/ 申请免费域名,有 Github 账号就能申请到,一个账号能申请到 3 个域名。
  2. 申请到的免费域名为: githubtest.us.kg
  3. 需要加速的域名为: xdocs.hanxi.cc
  4. githubtest.us.kghanxi.cc 都托管到 Cloudflare 。
  5. 子域名 xdocs.hanxi.cc 托管到阿里云。
  6. Cloudflare 开头 SaaS 只需要 Paypal 账号即可,Paypal 账号可以是国内账号,绑定国内储蓄卡就行。

githubtest.us.kg 在 Cloudflare 中的设置

  1. 配置 DNS : cdn.githubtest.us.kg ,开小黄云。
CNAME cdn hanxi.github.io
  1. SSL/TLS 加密设为完全。
  2. 自定义主机名:
    1. 添加回退源: cdn.githubtest.us.kg
    2. 添加自定义主机名: xdocs.hanxi.cc
    3. _cf-custom-hostname.xdocs.hanxi.cc_acme-challenge.xdocs.hanxi.cc 留着备用。

hanxi.cc 在 Cloudflare 中的设置

  1. 配置 DNS: xdocs.hanxi.cc
NS xdocs ns1.alidns.com
  1. 配置 DNS : alidnscheck.hanxi.cc ,值从下面的步骤中拿到。
TXT alidnscheck xxxxxxxxxxxxxxx

xdocs.hanxi.cc 在 aliyun 中的设置

  1. 添加域名解析: xdocs.hanxi.cc
  2. 获取到 alidnscheck 值,上面的步骤需要的。
  3. 添加解析:
TXT _cf-custom-hostname xxxxxxxxxxxxx
TXT _acme-challenge xxxxxxxxxxxxx

xxxxxxxxxxxxx 从前面的步骤中拿到。
4. 添加解析:

CNAME 默认 @ cloudflare.182682.xyz
CNAME 境外 @ hanxi.github.io

cloudflare.182682.xyz 是一个加速好的域名。

加速 workers

在 Cloudflare 中配置 DNS CNAME 即可,不开小黄云,值填 cloudflare.182682.xyz

加速自己的服务器

vps.hanxi.cc 通过 cdn.hanxi.us.kg 回源。

差异步骤:

hanxi.us.kg 在 Cloudflare 中的设置

  1. 配置 DNS : cdn.hanxi.us.kg ,开小黄云。
A cdn 123.123.123.123

vps.hanxi.cc 在 aliyun 中的设置

  1. 添加解析:
CNAME 默认 @ cloudflare.182682.xyz
CNAME 境外 @ vps.hanxi.cc

非 443 端口

需要在回原域名 hanxi.us.kg 中配置 Origin Rules 规则,选 更改端口 [模板]

主机名:cdn.hanxi.us.kg 重写到 8443 端口

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant