使用 Cloudflare 设置 Notion 自定义域名

Step 1. 设置 Notion 的公开主页(此项非必须)

  1. 创建一页 Page 作为公开分享的主页,例如 二一的笔记 这一页
  1. 在设置中,将这一页设置为 public home page
    1. notion image
  1. 然后你就可以通过 XXX.notion.site 来让人访问你公开的主页了

Step 2. 购买域名 eryi.love

下图以腾讯云为例
notion image

Step 3. 修改域名的 DNS 解析服务器为 Cloudflare

  1. 登录 我的域名 后台
  1. 找到刚才买的域名,然后点击右侧的管理
    1. notion image
  1. 找到 DNS 服务器,然后点击修改
    1. notion image
  1. 填入 Cloudflare 的域名解析服务器,然后提交
    1. notion image
       

Step 4. 登录 Cloudflare,然后添加网站 eryi.love

  1. 访问官网 https://dash.cloudflare.com/login ,注册账号并登录
    1. notion image
  1. 点击右上角添加网站
    1. notion image
  1. 添加后,会自动跳转到 Cloudflare 的付费会员选择页面,拉到下面,选择免费方案即可
    1. notion image

Step 5. DNS 设置域名解析

按照下图操作即可
notion image

Step 6. 检查 DNS 服务器地址是否正确

上一步结束后,会自动跳转到新的页面
请检查下图中红框内的 Cloudflare 名称服务器,与 Step 3. 中的第 4 小点是否一致,如果不一样的话,请返回 Step 3 再修改一遍
notion image
如果一致,则点击下一步即可

Step 7. 设置自定义 Cloudflare Workers 子域

按照下图操作
notion image
然后会自动跳转到 选择 Woker 计划,继续选择 Free 计划即可,然后根据提示,登录你的邮箱进行验证

Step 8. 创建新的 Wokers 服务

  1. 点击创建服务
    1. notion image
  1. 按照下图创建服务
    1. 服务名称可自定义
      notion image
  1. 在上一步成功创建服务后,按照下图进行操作
    1. notion image
  1. 然后添加路由
    1. notion image
  1. 按照下图操作,然后点击保存
    1. notion image
  1. 回到 wokers,然后进入代码编辑页面,按照下图顺序操作
    1. notion image
      notion image
      notion image
      全选代码,然后删除
      notion image

Step 9. 配置 Wokers 代码

  1. 访问这个网址 ,然后按照下图操作
    1. notion image
  1. 将代码粘贴到 Wokers 中,然后保存部署
    1. notion image

Step 10. 大功告成

现在你可以通过自己的域名来访问 Notion 主页了

参考文章

如何用Notion + CloudFlare 搭建个人博客