[{"data":1,"prerenderedAt":588},["ShallowReactive",2],{"chapter-post-project-replication-guide-04-domain-dns-and-redirect":3},{"chapter":4,"entry":73,"prev":212,"next":450},{"id":5,"title":6,"body":7,"category":55,"cover":52,"date":56,"description":57,"draft":58,"extension":59,"lang":60,"meta":61,"navigation":62,"path":63,"seo":64,"slug":65,"stem":66,"tags":67,"toc":62,"updated":56,"__hash__":72},"chapters/chapters/project-replication-guide.md","零基础完整复刻：Cloudflare 博客项目全流程",{"type":8,"value":9,"toc":51},"minimark",[10,14,17,30,33,45,48],[11,12,13],"p",{},"这个章节是你当前博客项目的“完整复刻手册”。",[11,15,16],{},"目标读者：",[18,19,20,24,27],"ul",{},[21,22,23],"li",{},"没有代码基础",[21,25,26],{},"第一次接触 GitHub、Cloudflare、Nuxt、Decap CMS",[21,28,29],{},"希望照着文档一步步做，最终得到与你当前项目一致的结果",[11,31,32],{},"学习方式建议：",[34,35,36,39,42],"ol",{},[21,37,38],{},"严格按顺序学习，不要跳步骤",[21,40,41],{},"每做完一节就执行“本节验收”",[21,43,44],{},"发现报错先看“常见问题”再继续",[11,46,47],{},"你可以直接从下面目录开始：",[49,50],"chapter-children",{},{"title":52,"searchDepth":53,"depth":53,"links":54},"",2,[],"Chapter","2026-02-14","面向零基础读者的完整项目复刻章节：从准备账号、搭建 Nuxt，到 Pages、Tunnel、CMS、评论、夜间模式与排障。",false,"md","zh-CN",{},true,"/chapters/project-replication-guide",{"title":6,"description":57},"project-replication-guide","chapters/project-replication-guide",[68,69,70,71],"复刻教程","Cloudflare","Nuxt","零基础","T31gU2a4Q3CvJ3Z2B2jyDvX4BtLMmICHnwzpIIudkao",{"id":74,"title":75,"body":76,"category":199,"chapterSlug":65,"cover":52,"date":56,"description":200,"draft":58,"extension":59,"lang":60,"legacySlugs":201,"meta":202,"navigation":62,"order":203,"path":204,"seo":205,"slug":206,"stem":207,"tags":208,"toc":62,"updated":56,"__hash__":211},"chapterPosts/chapter-posts/project-replication-guide/04-domain-dns-and-redirect.md","第 4 节：域名、DNS 与 301 跳转（主域统一）",{"type":8,"value":77,"toc":193},[78,83,86,89,101,105,108,134,140,144,147,150,161,165,168,175,178,186],[79,80,82],"h2",{"id":81},"_41-为什么要做裸域-301-到-www","4.1 为什么要做裸域 301 到 www",[11,84,85],{},"统一主域可以减少 SEO 分裂和链接重复。",[11,87,88],{},"你的目标是：",[18,90,91],{},[21,92,93,97,98],{},[94,95,96],"code",{},"https://xuyangfly.site/xxx"," 永久跳到 ",[94,99,100],{},"https://www.xuyangfly.site/xxx",[79,102,104],{"id":103},"_42-跳转规则怎么填","4.2 跳转规则怎么填",[11,106,107],{},"在 Cloudflare 中创建转发规则：",[34,109,110,116,122,128],{},[21,111,112,113],{},"URL 匹配：",[94,114,115],{},"xuyangfly.site/*",[21,117,118,119],{},"类型：",[94,120,121],{},"Forwarding URL",[21,123,124,125],{},"状态码：",[94,126,127],{},"301 - Permanent Redirect",[21,129,130,131],{},"目标：",[94,132,133],{},"https://www.xuyangfly.site/$1",[11,135,136,139],{},[94,137,138],{},"$1"," 代表原路径后半段，会被完整保留。",[79,141,143],{"id":142},"_43-为什么你会看到rule-may-not-apply-to-traffic","4.3 为什么你会看到“rule may not apply to traffic”",[11,145,146],{},"这提示表示：当前流量没走 Cloudflare 代理层。",[11,148,149],{},"修复：",[34,151,152,155,158],{},[21,153,154],{},"到 DNS 列表确认根域记录是橙云（Proxied）",[21,156,157],{},"如果没有合适记录，创建一个 A 记录占位并开启代理",[21,159,160],{},"保存后等待 1~5 分钟再测",[79,162,164],{"id":163},"_44-验证命令","4.4 验证命令",[11,166,167],{},"在浏览器访问：",[18,169,170],{},[21,171,172],{},[94,173,174],{},"https://xuyangfly.site/test?a=1",[11,176,177],{},"期望：",[18,179,180],{},[21,181,182,183],{},"地址栏最终变成 ",[94,184,185],{},"https://www.xuyangfly.site/test?a=1",[11,187,188,189,192],{},"如果是连接失败（如 ",[94,190,191],{},"ERR_CONNECTION_CLOSED","），优先回到 DNS 检查代理状态。",{"title":52,"searchDepth":53,"depth":53,"links":194},[195,196,197,198],{"id":81,"depth":53,"text":82},{"id":103,"depth":53,"text":104},{"id":142,"depth":53,"text":143},{"id":163,"depth":53,"text":164},"Guide","把裸域 xuyangfly.site 301 到 www，解决规则不生效与代理记录问题。",[],{},4,"/chapter-posts/project-replication-guide/04-domain-dns-and-redirect",{"title":75,"description":200},"04-domain-dns-and-redirect","chapter-posts/project-replication-guide/04-domain-dns-and-redirect",[68,209,210],"DNS",301,"578oUC4KJGN4YYl6zTyB-MLXMLtuDPxHNbfKQbOntiI",{"id":213,"title":214,"body":215,"category":199,"chapterSlug":65,"cover":52,"date":56,"description":438,"draft":58,"extension":59,"lang":60,"legacySlugs":439,"meta":440,"navigation":62,"order":441,"path":442,"seo":443,"slug":444,"stem":445,"tags":446,"toc":62,"updated":56,"__hash__":449},"chapterPosts/chapter-posts/project-replication-guide/03-github-and-cloudflare-pages.md","第 3 节：连接 GitHub 与 Cloudflare Pages（自动部署主链路）",{"type":8,"value":216,"toc":431},[217,221,228,231,256,259,267,270,274,277,302,306,309,329,332,341,353,357,360,366,369,378,381,389,393,399,413,416,427],[79,218,220],{"id":219},"_31-先确认代码已在-github","3.1 先确认代码已在 GitHub",[11,222,223,224,227],{},"你的目标仓库是：",[94,225,226],{},"adkeb/blog","。",[11,229,230],{},"本地执行：",[232,233,237],"pre",{"className":234,"code":235,"language":236,"meta":52,"style":52},"language-bash shiki shiki-themes github-light github-dark","git remote -v\n","bash",[94,238,239],{"__ignoreMap":52},[240,241,244,248,252],"span",{"class":242,"line":243},"line",1,[240,245,247],{"class":246},"sScJk","git",[240,249,251],{"class":250},"sZZnC"," remote",[240,253,255],{"class":254},"sj4cs"," -v\n",[11,257,258],{},"应看到：",[232,260,265],{"className":261,"code":263,"language":264,"meta":52},[262],"language-text","origin git@github.com:adkeb/blog.git\n","text",[94,266,263],{"__ignoreMap":52},[11,268,269],{},"如果不是这个地址，先修正 remote 再继续。",[79,271,273],{"id":272},"_32-在-cloudflare-创建-pages-项目","3.2 在 Cloudflare 创建 Pages 项目",[11,275,276],{},"操作路径（新版控制台）：",[34,278,279,285,291,296],{},[21,280,281,282],{},"进入 ",[94,283,284],{},"Workers & Pages",[21,286,287,288],{},"选择 ",[94,289,290],{},"Import an existing Git repository",[21,292,293,294],{},"选择 GitHub 账号与仓库 ",[94,295,226],{},[21,297,298,299],{},"生产分支选 ",[94,300,301],{},"main",[79,303,305],{"id":304},"_33-构建参数必须这样填","3.3 构建参数必须这样填",[11,307,308],{},"这一项非常关键，填错就会失败：",[34,310,311,317,323],{},[21,312,313,314],{},"Framework preset：",[94,315,316],{},"Nuxt.js",[21,318,319,320],{},"Build command：",[94,321,322],{},"npm run generate",[21,324,325,326],{},"Build output directory：",[94,327,328],{},"dist",[11,330,331],{},"你之前踩过的坑：",[18,333,334],{},[21,335,336,337,340],{},"填成 ",[94,338,339],{},".output/public","，会报 “build output directory not found”",[11,342,343,344,347,348,350,351,227],{},"原因：",[94,345,346],{},"nuxt generate"," 产物在 ",[94,349,328],{},"，而不是 ",[94,352,339],{},[79,354,356],{"id":355},"_34-你曾遇到的典型错误是怎么来的","3.4 你曾遇到的典型错误是怎么来的",[11,358,359],{},"报错：",[232,361,364],{"className":362,"code":363,"language":264,"meta":52},[262],"The name 'ASSETS' is reserved in Pages projects.\n",[94,365,363],{"__ignoreMap":52},[11,367,368],{},"本质原因：",[18,370,371],{},[21,372,373,374,377],{},"把 Worker 的 ",[94,375,376],{},"wrangler deploy"," 混进了 Pages 的构建流程",[11,379,380],{},"正确做法：",[34,382,383,386],{},[21,384,385],{},"Pages 只做站点构建与静态发布",[21,387,388],{},"Worker（如 OAuth）单独在本地/CI 用 wrangler 部署",[79,390,392],{"id":391},"_35-验收方法","3.5 验收方法",[11,394,395,396,398],{},"当你 push 到 ",[94,397,301],{}," 后：",[34,400,401,404,407],{},[21,402,403],{},"Cloudflare 自动出现新 deployment",[21,405,406],{},"状态为 Success（绿色）",[21,408,409,412],{},[94,410,411],{},"www.xuyangfly.site"," 可访问",[11,414,415],{},"部署失败时，优先查看：",[18,417,418,421,424],{},[21,419,420],{},"Build command",[21,422,423],{},"Output directory",[21,425,426],{},"是否有额外 deploy 命令误加",[428,429,430],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":52,"searchDepth":53,"depth":53,"links":432},[433,434,435,436,437],{"id":219,"depth":53,"text":220},{"id":272,"depth":53,"text":273},{"id":304,"depth":53,"text":305},{"id":355,"depth":53,"text":356},{"id":391,"depth":53,"text":392},"把仓库 adkeb/blog 接入 Pages，设置正确构建参数，避开常见部署报错。",[],{},3,"/chapter-posts/project-replication-guide/03-github-and-cloudflare-pages",{"title":214,"description":438},"03-github-and-cloudflare-pages","chapter-posts/project-replication-guide/03-github-and-cloudflare-pages",[68,447,448],"GitHub","Cloudflare Pages","LLAZYoqNkeb-e__OjK3h8vv8ZEdVqyLnVI-RE8JShJ0",{"id":451,"title":452,"body":453,"category":199,"chapterSlug":65,"cover":52,"date":56,"description":576,"draft":58,"extension":59,"lang":60,"legacySlugs":577,"meta":578,"navigation":62,"order":579,"path":580,"seo":581,"slug":582,"stem":583,"tags":584,"toc":62,"updated":56,"__hash__":587},"chapterPosts/chapter-posts/project-replication-guide/05-preview-tunnel-and-access.md","第 5 节：预览链路（Cloudflare Tunnel + Access）",{"type":8,"value":454,"toc":569},[455,459,462,481,485,488,502,505,509,512,515,523,527,530,533,544,548,551],[79,456,458],{"id":457},"_51-架构目标","5.1 架构目标",[11,460,461],{},"你要达到下面 2 条：",[34,463,464,471],{},[21,465,466,467,470],{},"主站永远公开可用（",[94,468,469],{},"www","）",[21,472,473,474,477,478,470],{},"预览与运维私有访问（",[94,475,476],{},"preview"," / ",[94,479,480],{},"ops",[79,482,484],{"id":483},"_52-草稿显示机制","5.2 草稿显示机制",[11,486,487],{},"通过变量控制：",[18,489,490,496],{},[21,491,492,493],{},"Production：",[94,494,495],{},"NUXT_PUBLIC_SHOW_DRAFTS=false",[21,497,498,499],{},"Preview：",[94,500,501],{},"NUXT_PUBLIC_SHOW_DRAFTS=true",[11,503,504],{},"这样同一套代码在不同环境会得到不同可见性。",[79,506,508],{"id":507},"_53-tunnel-的职责","5.3 Tunnel 的职责",[11,510,511],{},"Tunnel 不是托管主站内容，而是把本地预览服务安全暴露出去。",[11,513,514],{},"典型用途：",[18,516,517,520],{},[21,518,519],{},"草稿内容预览",[21,521,522],{},"私有后台入口",[79,524,526],{"id":525},"_54-access-的职责","5.4 Access 的职责",[11,528,529],{},"Access 是“谁能进来”的门禁系统。",[11,531,532],{},"你应配置：",[34,534,535,538,541],{},[21,536,537],{},"只允许你的邮箱登录",[21,539,540],{},"会话有效期缩短（例如 1~8 小时）",[21,542,543],{},"打开审计日志",[79,545,547],{"id":546},"_55-验收测试","5.5 验收测试",[11,549,550],{},"必须做这 3 条：",[34,552,553,559,566],{},[21,554,555,556,558],{},"关闭本地 Tunnel 后，",[94,557,469],{}," 仍能访问。",[21,560,561,562,565],{},"未授权访问 ",[94,563,564],{},"preview.*","，看到拦截页。",[21,567,568],{},"授权后能访问预览站，并看到草稿。",{"title":52,"searchDepth":53,"depth":53,"links":570},[571,572,573,574,575],{"id":457,"depth":53,"text":458},{"id":483,"depth":53,"text":484},{"id":507,"depth":53,"text":508},{"id":525,"depth":53,"text":526},{"id":546,"depth":53,"text":547},"把草稿预览和后台放到私有入口，确保 Tunnel 失效不影响公开主站。",[],{},5,"/chapter-posts/project-replication-guide/05-preview-tunnel-and-access",{"title":452,"description":576},"05-preview-tunnel-and-access","chapter-posts/project-replication-guide/05-preview-tunnel-and-access",[68,585,586],"Tunnel","Zero Trust","xw4xbvKHiLSWUi6NwiRDw5FtQ_GiERPmprH3_HLe6fU",1771232916065]