<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"><channel><title>Halo - 强大易用的开源建站工具</title><link>https://www.halo.run</link><atom:link href="https://www.halo.run/feed.xml" rel="self" type="application/rss+xml"/><description>Halo - 强大易用的开源建站工具</description><generator>Halo v2.24.1</generator><language>zh-cn</language><image><url>https://www.halo.run/upload/logo.png</url><title>Halo - 强大易用的开源建站工具</title><link>https://www.halo.run</link></image><lastBuildDate>Wed, 29 Apr 2026 18:38:03 GMT</lastBuildDate><follow_challenge><feedId>69597013489248256</feedId><userId>41706424548048896</userId></follow_challenge><item><title><![CDATA[如何自动备份 Halo 网站]]></title><link>https://www.halo.run/archives/how-to-auto-backup-halo</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%A6%82%E4%BD%95%E8%87%AA%E5%8A%A8%E5%A4%87%E4%BB%BD%20Halo%20%E7%BD%91%E7%AB%99&amp;url=/archives/how-to-auto-backup-halo" width="1" height="1" alt="" style="opacity:0;">
<p>定期备份是保障网站数据安全的基本措施。Halo 支持多种自动备份方式，本文将介绍两种常用方案：通过<strong>增强备份插件</strong>实现站内定时备份与远程同步，以及通过 <strong>1Panel</strong> 的计划任务功能备份网站数据。</p>
<h2 id="方式一通过增强备份插件">方式一：通过增强备份插件</h2>
<p><a href="https://www.halo.run/store/apps/app-dHakX">增强备份插件</a>是 <strong>Halo 专业版 / 商城版专享</strong>的高级功能，支持配置定时自动备份和远程同步，适合需要可靠自动化备份方案的用户。</p>
<blockquote>
 <p><strong>注意</strong>：目前 Halo 备份暂不支持备份商城功能的数据。如果你使用了 Halo 的商城功能，推荐参考下方<strong>方式二</strong>，使用 1Panel 计划任务对网站数据进行完整备份。</p>
</blockquote>
<h3 id="前提条件">前提条件</h3>
<ul>
 <li>已安装并激活<strong>增强备份</strong>插件（需 Halo 专业版或商城版）</li>
 <li>如需开启远程同步，需提前安装 <a href="https://www.halo.run/store/apps/app-Qxhpp">S3 插件</a> 并创建好对应的存储策略。需要注意的是，出于数据安全考虑，不要将此存储策略的存储桶设置为公开访问。</li>
</ul>
<h3 id="配置定时任务">配置定时任务</h3>
<p>安装插件后，进入 Halo 控制台<strong>备份</strong>页面，点击<strong>定时任务</strong>选项卡，按以下说明完成配置：</p>
<p><img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FGXcuKGCXtadMVpUQmqoJQSePfsQlwLIN.png&amp;size=m" alt="Halo 备份插件定时任务"></p>
<ol>
 <li><strong>是否启用</strong>：开启总开关；</li>
 <li><strong>计划</strong>：选择备份频率，支持每月、每周、每天、每小时；</li>
 <li><strong>时区</strong>：选择与服务器时区一致的选项；</li>
 <li><strong>备份设置</strong>：
  <ul>
   <li><strong>备份过期时间</strong>：设置备份文件的有效期，支持 <code>d</code>（天）、<code>h</code>（小时）、<code>m</code>（分）为单位；</li>
   <li><strong>成功记录保留份数</strong>：保留最近 N 份成功备份记录，较旧的记录会自动删除；</li>
   <li><strong>失败记录保留份数</strong>：保留最近 N 份失败备份记录，较旧的记录会自动删除；</li>
  </ul></li>
 <li>配置完成后点击<strong>保存</strong>。</li>
</ol>
<blockquote>
 <p>所有自动创建的备份都会以 <code>cron-backup-</code> 开头，方便与手动备份区分。</p>
</blockquote>
<h3 id="配置远程同步可选">配置远程同步（可选）</h3>
<p>如果希望将备份文件同步到远程对象存储，可在同一配置页面开启<strong>启用远程同步</strong>：</p>
<ol>
 <li>
  <p><strong>附件存储策略</strong>：选择一个已创建的<strong>远程且私有</strong>的存储策略（推荐通过 S3 插件配置）；</p>
  <blockquote>
   <p>出于安全考虑，此处不会列出本地类型的存储策略。创建存储策略的方法可参考：<a href="https://docs.halo.run/user-guide/attachments#%E5%AD%98%E5%82%A8%E7%AD%96%E7%95%A5">附件存储策略文档</a></p>
  </blockquote>
 </li>
 <li>
  <p><strong>附件分组</strong>：可为备份文件单独创建一个附件分组，便于管理；</p>
 </li>
 <li>
  <p><strong>成功 / 失败记录保留份数</strong>：分别配置同步记录的保留数量。</p>
 </li>
</ol>
<p>配置保存后，可在<strong>同步任务</strong>选项卡中查看所有同步记录及状态。</p>
<p><img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FGrkNJZmMXbUaQQaZQmqgGADgCOkBnWFp.png&amp;size=m" alt="Halo 备份插件远程同步设置"></p>
<p><img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FbFxoZkQghkFmjGHWEmqXamPxEIbOrCIX.png&amp;size=m" alt="Halo 备份插件同步任务记录"></p>
<p>最后，如果你需要恢复备份，可以参考：<a href="https://docs.halo.run/user-guide/backup#%E6%81%A2%E5%A4%8D">备份与恢复</a></p>
<h2 id="方式二通过-1panel-自动备份">方式二：通过 1Panel 自动备份</h2>
<p>如果你的服务器使用了 <a href="https://1panel.cn">1Panel</a> 面板，可以直接利用其内置的计划任务功能，定期备份 Halo 所在网站的全部数据，包括数据库和站点文件。</p>
<h3 id="第一步配置备份账号可选">第一步：配置备份账号（可选）</h3>
<p>默认情况下，备份文件会保存在当前服务器的本地磁盘。如果希望将备份数据同步到云存储，需要先添加备份账号。</p>
<ol>
 <li>进入 1Panel 控制台，点击左侧菜单<strong>面板设置</strong>；</li>
 <li>切换到<strong>备份账号</strong>选项卡；</li>
 <li>点击<strong>添加备份账号</strong>，选择对应的存储类型，填写认证信息后确认。</li>
</ol>
<p><img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FdtCHlFogUHawaUjzkqKSveCFzfFjthuF.png&amp;size=m" alt="1Panel 编辑备份账号"></p>
<p>目前支持的存储类型包括：阿里云 OSS、腾讯云 COS、亚马逊 S3、微软 OneDrive、谷歌云盘、阿里云盘、MINIO、WebDAV、SFTP、七牛云 Kodo、又拍云对象存储等。</p>
<p>具体配置文档可参考：<a href="https://1panel.cn/docs/v2/user_manual/settings/#4">备份账号</a></p>
<blockquote>
 <p>如果不配置备份账号，备份文件将保存在服务器本地磁盘，请确保磁盘有足够的剩余空间。</p>
</blockquote>
<h3 id="第二步创建备份网站计划任务">第二步：创建备份网站计划任务</h3>
<ol>
 <li>进入 1Panel 控制台，点击左侧菜单<strong>计划任务</strong>；</li>
 <li>点击<strong>创建计划任务</strong>，任务类型选择<strong>备份网站</strong>；</li>
</ol>
<p><img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FYVHZhKYpEuxEKgSqussqjoYOTkzBnpdZ.png&amp;size=m" alt="1Panel 创建网站备份任务"></p>
<ol start="3">
 <li>按以下说明填写配置：
  <ul>
   <li><strong>执行周期</strong>：选择备份执行的时间，支持同时配置多个执行周期；</li>
   <li><strong>备份网站</strong>：选择 Halo 所在的网站，也可以选择备份所有网站；</li>
   <li><strong>备份账号</strong>：选择上一步配置的备份账号，若未配置则默认备份到当前服务器磁盘；</li>
   <li><strong>压缩密码</strong>：为备份压缩包设置保护密码（可选）；</li>
   <li><strong>保留份数</strong>：默认保留 7 份，可根据磁盘空间情况调整；</li>
   <li><strong>排除规则</strong>：可排除不需要备份的文件，例如日志文件或临时目录；</li>
  </ul></li>
 <li>配置完成后点击<strong>确认</strong>，计划任务即生效。</li>
</ol>
<p>任务执行完成后，可在计划任务列表点击对应任务查看<strong>执行报告</strong>，确认备份是否成功，并可直接下载备份文件。</p>
<p><img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FpuNPRUwzaePSEZsDKoysADEdJUrIncOF.png&amp;size=m" alt="1Panel 计划任务执行信息"></p>
<p>1Panel 如何恢复网站备份可查阅：<a href="https://1panel.cn/docs/v1/user_manual/websites/website_backup/#4">导入备份</a></p>]]></description><guid isPermaLink="false">/archives/how-to-auto-backup-halo</guid><dc:creator>Ryan Wang</dc:creator><category>使用技巧</category><category>运维</category><pubDate>Wed, 22 Apr 2026 05:57:00 GMT</pubDate></item><item><title><![CDATA[让 AI Agents 管理 Halo 网站内容]]></title><link>https://www.halo.run/archives/ai-agents-content-management</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E8%AE%A9%20AI%20Agents%20%E7%AE%A1%E7%90%86%20Halo%20%E7%BD%91%E7%AB%99%E5%86%85%E5%AE%B9&amp;url=/archives/ai-agents-content-management" width="1" height="1" alt="" style="opacity:0;">
<p style=""><a href="https://github.com/halo-dev/cli" target="_blank" rel="">Halo CLI</a> 是一个用于管理 Halo 实例的命令行工具，覆盖文章、单页、评论、通知、附件、插件、主题、备份等操作。</p>
<p style="">除了命令行本身，它还附带了一套 <strong>Skills</strong>——这是专门为 AI Agent 设计的上下文文件，告诉 Agent 这个 CLI 有哪些命令、如何使用，Agent 读取 Skills 之后就能直接操作你的 Halo 站点，不需要你手动解释每一步怎么做。</p>
<h2 style="" id="%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C">准备工作</h2>
<p style=""><strong>安装 CLI</strong></p>
<pre><code class="language-bash">npm install -g @halo-dev/cli  # 要求 Node.js &gt;= 22</code></pre>
<p style=""><strong>登录 Halo 站点</strong></p>
<p style="">在 Halo 后台「个人中心 - 个人令牌」生成一个 Token，然后在终端执行：</p>
<pre><code class="language-bash">halo auth login \
  --profile myblog \
  --url https://your-halo-site.com \
  --auth-type bearer \
  --token &lt;your-token&gt;</code></pre>
<p style=""><strong>安装 Skills</strong></p>
<pre><code class="language-bash">npx skills add halo-dev/cli -g</code></pre>
<h2 style="" id="%E6%93%8D%E4%BD%9C%E5%89%8D%E5%85%88%E5%A4%87%E4%BB%BD">操作前先备份</h2>
<p style="">如果你不完全放心让 Agent 修改网站内容，可以在操作之前，完整备份网站：</p>
<pre><code class="language-bash">halo backup create --wait</code></pre>
<h2 style="" id="%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8">开始使用</h2>
<p style="">打开任意支持 Skills 的 AI 客户端或 Agent 工具，比如 <strong>Claude Code</strong>、<strong>Codex</strong>、<strong>OpenClaw</strong>、<strong>QClaw</strong> 等，加载 Skills 后直接用自然语言描述任务即可。</p>
<h2 style="" id="%E5%9C%BA%E6%99%AF%E4%B8%80%EF%BC%9Aseo-%E6%A3%80%E6%9F%A5%E5%B9%B6%E4%BF%AE%E5%A4%8D%E6%9C%80%E8%BF%91%E7%9A%84%E6%96%87%E7%AB%A0">场景一：SEO 检查并修复最近的文章</h2>
<p style=""><strong>提示词：</strong></p>
<pre><code class="language-plaintext">帮我用 Halo CLI 检查最近发布的 10 篇文章的 SEO 情况：
标题是否清晰、摘要是否存在且合适、标签和分类是否合理。
找出有问题的文章，直接帮我修复。</code></pre>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FbvxVKRYWMszvdzRxgPGVGvuqUGTTMXcM.png&amp;size=m" alt="Halo CLI 检查最近发布文章的 SEO 情况" width="100%" height="auto">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FXEHVACnNLWJmpkNRtjyuKdvccxjEoVVu.png&amp;size=m" alt="Halo CLI 检查最近发布文章的 SEO 情况" width="100%">
</figure>
<blockquote>
 <p style="">此示例使用 <a href="https://qclaw.qq.com/" target="_blank" rel="">QClaw</a></p>
</blockquote>
<h2 style="" id="%E5%9C%BA%E6%99%AF%E4%BA%8C%EF%BC%9A%E4%BC%98%E5%8C%96%E6%9F%90%E7%AF%87%E6%96%87%E7%AB%A0">场景二：优化某篇文章</h2>
<p style=""><strong>提示词：</strong></p>
<pre><code class="language-plaintext">帮我用 Halo CLI 优化 my-slow-post 这篇文章：
分析标题、内容、摘要、标签是否有改进空间，给出建议后直接执行。</code></pre>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FDJgqjZeFOjDrIjlGBEIJySuGCMtSbtym.png&amp;size=m" alt="Halo 通过 Agent 优化文章 SEO" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FxWnLIMlBFeENHXWJopdEmKiNMJCBVBqU.png&amp;size=m" alt="Halo 通过 Agent 优化文章 SEO 的效果" width="100%">
</figure>
<blockquote>
 <p style="">此示例使用 <a href="https://github.com/features/copilot/cli" target="_blank" rel="">Copilot CLI</a></p>
</blockquote>
<h2 style="" id="%E5%9C%BA%E6%99%AF%E4%B8%89%EF%BC%9A%E5%AE%A1%E6%A0%B8%E5%B9%B6%E5%9B%9E%E5%A4%8D%E8%AF%84%E8%AE%BA">场景三：审核并回复评论</h2>
<p style=""><strong>提示词：</strong></p>
<pre><code class="language-plaintext">用 Halo CLI 查看所有待审核的评论，广告或无意义的直接删掉，
有实质性问题的通过并回复。</code></pre>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FwTKxNnHjRLKkcULReNFUHxjjxYoROQAg.png&amp;size=m" alt="Halo 通过 Agent 审核评论" width="100%">
</figure>
<blockquote>
 <p style="">此示例使用 <a href="https://qclaw.qq.com/" target="_blank" rel="">QClaw</a></p>
</blockquote>
<h2 style="" id="%E5%9C%BA%E6%99%AF%E5%9B%9B%EF%BC%9A%E6%9B%B4%E6%96%B0%E3%80%8C%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC%E3%80%8D%E9%A1%B5%E9%9D%A2">场景四：更新「关于我们」页面</h2>
<p style=""><strong>提示词：</strong></p>
<pre><code class="language-plaintext">用 Halo CLI 把「关于我们」单页里的联系邮箱改为 hi@example.com，
工作地址新增一个重庆，改完发布。</code></pre>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FaNWCYWbQUGnQOfgBnbgwRfshGeSNRhhD.png&amp;size=m" alt="Halo 通过 Agent 修改关于页面内容" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FWbvpVQZgYfzRiBcEnEBYdWSUfRMTgaHx.png&amp;size=m" alt="Halo 通过 Agent 修改关于页面内容的效果" width="100%">
</figure>
<blockquote>
 <p style="">此示例使用 <a href="https://github.com/features/copilot/cli" target="_blank" rel="">Copilot CLI</a></p>
</blockquote>
<h2 style="" id="%E5%9C%BA%E6%99%AF%E4%BA%94%EF%BC%9A%E6%A3%80%E6%9F%A5%E5%B9%B6%E5%8D%87%E7%BA%A7%E6%8F%92%E4%BB%B6">场景五：检查并升级插件</h2>
<p style=""><strong>提示词：</strong></p>
<pre><code class="language-plaintext">使用 Halo CLI 帮我看看当前 Halo 站点有哪些插件可以升级，告诉我每个插件当前版本和最新版本内容
确认之后再升级。</code></pre>
<p style="">Agent 会先列出所有可升级的插件及版本差异，等你确认后再执行升级。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FobMVZOPZrabjvPsdoktHaGWOvohqezVy.png&amp;size=m" alt="Halo 通过 Agent 检查插件的更新" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FgQqirFeAfecaQNNmLQcLSPGqVcZWpLCv.png&amp;size=m" alt="Halo 通过 Agent 批量升级插件" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FUfiVTFinFfpfBBjhdJsugTugKiznAnAE.png&amp;size=m" alt="Halo 通过 Agent 批量升级插件的效果" width="100%">
</figure>
<blockquote>
 <p style="">此示例使用 <a href="https://github.com/features/copilot/cli" target="_blank" rel="">Copilot CLI</a></p>
</blockquote>
<h2 style="" id="%E6%80%BB%E7%BB%93">总结</h2>
<p style="">上面这几个场景只是起点。Halo CLI 覆盖了主题、附件、备份等更多操作，配合 Skills 之后，Agent 同样能理解和执行这些命令。日常运营中遇到什么重复性的事，都可以试着直接告诉 Agent，让它想办法用 CLI 完成。</p>
<p style="">如果有想支持但还没有的功能，或者用下来遇到了问题，欢迎到 <a href="https://github.com/halo-dev/cli/issues">halo-dev/cli</a> 提 Issue，我们持续在完善。</p>]]></description><guid isPermaLink="false">/archives/ai-agents-content-management</guid><dc:creator>Ryan Wang</dc:creator><category>使用技巧</category><pubDate>Tue, 21 Apr 2026 08:28:00 GMT</pubDate></item><item><title><![CDATA[支持商城小程序，Halo 2.24 发布]]></title><link>https://www.halo.run/archives/halo-2.24-released</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E6%94%AF%E6%8C%81%E5%95%86%E5%9F%8E%E5%B0%8F%E7%A8%8B%E5%BA%8F%EF%BC%8CHalo%202.24%20%E5%8F%91%E5%B8%83&amp;url=/archives/halo-2.24-released" width="1" height="1" alt="" style="opacity:0;">
<p style="">Halo 是一款强大易用的开源建站工具，它让你无需太多的技术知识就可以快速搭建一个商城、企业网站或者内容管理系统。具备可插拔架构、主题套用、富文本编辑器等多重特性，支持用户根据自己的喜好选择不同类型的插件及主题模板来定制化自己的站点功能及外观。让内容创作和发布更加便捷生动。</p>
<p style="">截至目前（2026 年 Q1 季度），Halo 已经在 Docker Hub 获得了超过 340 万次下载，GitHub Star 数突破 38 k，并拥有一百多名社区贡献者。</p>
<p style="">2026 年 04 月 16 日，强大易用的开源建站工具 Halo 正式发布 2.24 版本。</p>
<h2 style="" id="%E4%BA%AE%E7%82%B9%E6%9B%B4%E6%96%B0">亮点更新</h2>
<h3 style="" id="halo-%E5%95%86%E5%9F%8E%E5%B0%8F%E7%A8%8B%E5%BA%8F">Halo 商城小程序</h3>
<p style="">在 Halo 2.24 中，Halo 商城支持以微信小程序作为销售终端。相较于 Web 端，小程序在国内拥有更高的用户渗透率，更适合承载移动端购物场景。</p>
<p style="">查看小程序源码及文档：<a href="https://github.com/lxware-dev/halo-shop-miniprogram">lxware-dev/halo-shop-miniprogram</a></p>
<p style="">更多关于小程序的介绍可以访问：<a href="https://www.lxware.cn/archives/mini-program">https://www.lxware.cn/archives/mini-program</a></p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FiczbMbihXqsxNMhqYlKkrNYgfNeSygzQ.png&amp;size=m" alt="Halo 商城小程序预览" width="2071px">
</figure>
<h3 style="" id="%E5%88%9B%E5%BB%BA%E4%B8%AA%E4%BA%BA%E4%BB%A4%E7%89%8C%E6%94%AF%E6%8C%81%E7%9B%B4%E6%8E%A5%E9%80%89%E6%8B%A9%E8%A7%92%E8%89%B2">创建个人令牌支持直接选择角色</h3>
<p style="">在 Halo 2.24 中，创建个人令牌支持直接选择当前已有的角色，简化了创建个人令牌的权限选择步骤。</p>
<p style="">比如，你想通过 <a href="https://github.com/halo-dev/cli">Halo CLI</a> 管理网站的所有文章，但不想授予过多权限，那么可以在创建个人令牌的时候直接选择 <strong>文章管理员</strong>。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FIzLLvlxjapfhKPHYroZPRKbggIWvFZze.png&amp;size=m" alt="Halo 创建个人令牌" width="100%" height="auto">
</figure>
<h2 style="" id="%E5%AE%8C%E6%95%B4%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97">完整更新日志</h2>
<ul>
 <li>
  <p style="">付费版：<a href="https://releases.halo.run/releases/halo-pro/v2.24.0" target="_self" rel="">https://releases.halo.run/releases/halo-pro/v2.24.0</a></p>
 </li>
 <li>
  <p style="">社区版：<a href="https://releases.halo.run/releases/halo/v2.24.0" target="_blank" rel="">https://releases.halo.run/releases/halo/v2.24.0</a></p>
 </li>
</ul>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/halo-2.24-released</guid><dc:creator>Ryan Wang</dc:creator><enclosure url="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FuUTIzFermuWzZbFvpPfGmTKOgqyZZoLr.jpg&amp;size=m" type="image/jpeg" length="32390"/><category>版本发布</category><pubDate>Mon, 20 Apr 2026 13:04:25 GMT</pubDate></item><item><title><![CDATA[如何在本地快速体验 Halo]]></title><link>https://www.halo.run/archives/halo-local-quickstart</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%A6%82%E4%BD%95%E5%9C%A8%E6%9C%AC%E5%9C%B0%E5%BF%AB%E9%80%9F%E4%BD%93%E9%AA%8C%20Halo&amp;url=/archives/halo-local-quickstart" width="1" height="1" alt="" style="opacity:0;">
<p style="">本文介绍如何在本地环境快速启动一个 Halo 实例，便于你在本机体验或者测试 Halo 的功能。</p>
<p style="">下面给出两种常见做法：使用 <code>java -jar</code> 运行官方构建的 JAR，或使用 <code>docker run</code> 拉起单容器。二者都默认使用内置 H2 数据库，不必单独安装 MySQL 或 PostgreSQL；数据会落在本机用户目录下的工作文件夹中（后文会说明具体路径）。</p>
<p style="">如果你想购买服务器在生产环境部署，请参考：<a href="https://docs.halo.run/category/%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97">安装指南</a></p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E4%BD%BF%E7%94%A8-java--jar">方式一：使用 <code>java -jar</code></h2>
<h3 style="" id="%E5%AE%89%E8%A3%85-jdk">安装 JDK</h3>
<p style="">后端基于 Java 21 构建，推荐使用 <a href="https://adoptium.net/" target="_blank" rel="">Eclipse Temurin</a> 发行版。</p>
<ul>
 <li>
  <p style=""><strong>macOS / Linux</strong></p>
  <pre><code class="language-bash"># 推荐使用 SDKMAN 管理 JDK 版本，如已安装可略过
curl -s "https://get.sdkman.io" | bash

# 安装 JDK 21
sdk install java 21-tem</code></pre>
 </li>
 <li>
  <p style=""><strong>Windows</strong></p>
  <p style="">前往 <a href="https://adoptium.net" target="_blank" rel="">https://adoptium.net</a> 下载 JDK 21 安装包，按向导安装即可。</p>
 </li>
</ul>
<h3 style="" id="%E5%90%AF%E5%8A%A8"><strong>启动</strong></h3>
<ol>
 <li>
  <p style="">从 <a href="https://github.com/halo-dev/halo/releases" target="_blank" rel="">GitHub Releases</a> 或 <a href="https://download.halo.run/" target="_blank" rel="">download.halo.run</a> 下载最新的 <code>halo-*.jar</code>，放到任意目录（下文假设文件名为 <code>halo.jar</code>）。</p>
 </li>
 <li>
  <p style="">在该目录执行：</p>
  <p style=""><strong>macOS / Linux</strong></p>
  <pre><code class="language-bash">java -jar halo.jar</code></pre>
  <p style=""><strong>Windows（在 PowerShell 或 CMD 中）</strong></p>
  <pre><code class="language-bash">java -jar halo.jar</code></pre>
 </li>
 <li>
  <p style="">启动成功后，在浏览器打开 <code>http://localhost:8090</code>，按向导完成初始化。</p>
 </li>
 <li>
  <p style="">结束体验时，在运行 <code>java</code> 的终端中按 <code>Ctrl+C</code> 停止进程。</p>
 </li>
</ol>
<p style=""><strong>数据存放位置</strong>：未自定义配置时，Halo 会将工作目录（含内置 H2 数据库、附件等）放在当前用户主目录下的 <code>.halo2</code>，即 macOS / Linux 为 <code>~/.halo2</code>，Windows 为 <code>%USERPROFILE%\.halo2</code>。</p>
<p style=""><strong>提示</strong>：H2 为嵌入式文件数据库，不适合作为生产唯一存储；正式环境请换用 PostgreSQL 等并做好 <a href="https://docs.halo.run/user-guide/backup" target="_blank" rel="" class="ui-citation-link">备份</a>。需要自定义端口、外部访问地址或数据库时，可参考 <a href="https://docs.halo.run/getting-started/install/jar-file" target="_blank" rel="" class="ui-citation-link">使用 JAR 文件部署</a>。</p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E4%BD%BF%E7%94%A8-docker-run">方式二：使用 <code>docker run</code></h2>
<h3 style="" id="%E5%AE%89%E8%A3%85-docker">安装 Docker</h3>
<ul>
 <li>
  <p style=""><strong>macOS</strong>：推荐安装 <a href="https://orbstack.dev/" target="_blank" rel="">OrbStack</a>（轻量、启动快）或 <a href="https://www.docker.com/products/docker-desktop/" target="_blank" rel="">Docker Desktop</a></p>
 </li>
 <li>
  <p style=""><strong>Windows</strong>：推荐安装 <a href="https://www.docker.com/products/docker-desktop/" target="_blank" rel="">Docker Desktop</a></p>
 </li>
 <li>
  <p style=""><strong>Linux</strong>：参考 <a href="https://docs.docker.com/engine/install/" target="_blank" rel="">Docker 官方安装文档</a></p>
 </li>
</ul>
<p style="">安装完成后请确保 Docker 守护进程已运行。</p>
<h3 style="" id="%E5%90%AF%E5%8A%A8-1">启动</h3>
<ol>
 <li>
  <p style="">执行：</p>
  <pre><code class="language-bash"># 社区版
docker run -it -d --name halo -p 8090:8090 -v ~/.halo2:/root/.halo2 halohub/halo:2

# 专业版 / 商城版
docker run -it -d --name halo -p 8090:8090 -v ~/.halo2:/root/.halo2 halohub/halo-pro:2</code></pre>
  <p style="">若拉取 Docker Hub 较慢，可将镜像名替换为 <code>registry.fit2cloud.com/halo/halo:2</code> 或 <code>registry.fit2cloud.com/halo/halo-pro:2</code> 。</p>
 </li>
 <li>
  <p style="">浏览器访问 <code>http://localhost:8090</code> 完成初始化。</p>
 </li>
 <li>
  <p style="">不再使用时停止并删除容器：</p>
  <pre><code class="language-bash">docker stop halo
docker rm halo</code></pre>
 </li>
</ol>
<p style=""><strong>数据存放位置</strong>：与 JAR 方式一致，通过 <code>-v ~/.halo2:/root/.halo2</code> 将容器内工作目录映射到本机 <code>~/.halo2</code>（Windows 请将 <code>~/.halo2</code> 换为 <code>%USERPROFILE%\.halo2</code> 对应的实际路径）。</p>
<h2 style="" id="%E4%B8%A4%E7%A7%8D%E6%96%B9%E5%BC%8F%E6%80%8E%E4%B9%88%E9%80%89">两种方式怎么选</h2>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>方式</th>
    <th>适合谁</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td><code>java -jar</code></td>
    <td>已装 JDK、希望直接看日志、或要在本机调试 JVM 参数</td>
   </tr>
   <tr>
    <td><code>docker run</code></td>
    <td>本机不想装 Java、或希望环境更接近容器化部署</td>
   </tr>
  </tbody>
 </table>
</div>
<p style="">两种方式若都使用默认挂载路径，数据目录都会落在 <code>~/.halo2</code>（Windows 为 <code>%USERPROFILE%\.halo2</code>），请勿在同一目录被两个进程同时占用：若先用 JAR 跑过，再改用 Docker，请先停掉 JAR 进程，或给 Docker 换一个挂载路径。</p>]]></description><guid isPermaLink="false">/archives/halo-local-quickstart</guid><dc:creator>Ryan Wang</dc:creator><category>Halo 101</category><pubDate>Sat, 18 Apr 2026 14:40:00 GMT</pubDate></item><item><title><![CDATA[使用 Halo CLI + GitHub Actions 持续部署主题]]></title><link>https://www.halo.run/archives/theme-cd-github-actions</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E4%BD%BF%E7%94%A8%20Halo%20CLI%20%2B%20GitHub%20Actions%20%E6%8C%81%E7%BB%AD%E9%83%A8%E7%BD%B2%E4%B8%BB%E9%A2%98&amp;url=/archives/theme-cd-github-actions" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E9%80%82%E5%90%88%E5%93%AA%E4%BA%9B%E5%9C%BA%E6%99%AF%EF%BC%9F">适合哪些场景？</h2>
<p style="">在开始之前，请先确认这个方案是否适合你。它主要面向以下两类用户：</p>
<ol>
 <li>
  <p style=""><strong>自研自用</strong>：主题由你自己开发并用于自己的网站，希望在每次推送代码后，主题能自动构建并更新到线上站点，省去手动上传的步骤。</p>
 </li>
 <li>
  <p style=""><strong>开发测试</strong>：主题计划分享给他人使用，但需要在自己的站点上持续验证最新构建产物的效果。</p>
 </li>
</ol>
<p style="">如果你只是使用他人开发的主题，通过控制台的应用市场一键更新即可，不需要本文介绍的方案。</p>
<h2 style="" id="%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C">准备工作</h2>
<ul>
 <li>
  <p style="">主题代码已托管在 GitHub 仓库</p>
 </li>
 <li>
  <p style="">主题具备完整的构建流程（例如使用 pnpm build 输出 <code>dist/*.zip</code>）</p>
 </li>
 <li>
  <p style="">Halo 站点可以通过公网访问，并已生成 API Token</p>
 </li>
</ul>
<p style="">推荐在主题的 package.json 的 build 脚本中引入 <code>@halo-dev/theme-package-cli</code>，自动构建一个 zip 包，并输出到 dist 目录，示例：</p>
<pre><code class="language-json">{
  "scripts": {
    "build": "vite build &amp;&amp; npx @halo-dev/theme-package-cli"
  }
}</code></pre>
<p style=""><strong>生成 API Token：</strong></p>
<p style="">在 Halo 控制台进入<strong>个人中心 → 个人令牌</strong>，创建一个新的 Token，包含 <strong>主题管理</strong> 权限，并将其保存到 GitHub 仓库的 <strong>Settings → Secrets and variables → Actions</strong> 中，变量名设置为 <code>HALO_TOKEN</code>。</p>
<blockquote>
 <p style="">注意：此操作需要升级到 Halo 2.24，否则 <strong>主题管理 </strong>权限可能无法调用升级主题的接口。</p>
</blockquote>
<h2 style="" id="%E5%B7%A5%E4%BD%9C%E6%B5%81%E8%AF%B4%E6%98%8E">工作流说明</h2>
<p style="">整个 CI/CD 流程分为以下几步：</p>
<ol>
 <li>
  <p style="">推送代码到 <code>main</code> 分支</p>
 </li>
 <li>
  <p style="">GitHub Actions 自动触发，检出代码</p>
 </li>
 <li>
  <p style="">使用短 commit SHA 更新 <code>theme.yaml</code> 中的版本号，便于追踪每次构建</p>
 </li>
 <li>
  <p style="">安装依赖并执行构建，输出主题 zip 包</p>
 </li>
 <li>
  <p style="">将构建产物上传为 Artifact 归档备份</p>
 </li>
 <li>
  <p style="">安装 <a href="https://github.com/halo-dev/cli" target="_blank" rel="">Halo CLI</a>，使用 Bearer Token 完成登录认证</p>
 </li>
 <li>
  <p style="">调用 <code>halo theme upgrade</code> 将新构建的主题包推送到 Halo 站点</p>
 </li>
</ol>
<h2 style="" id="github-actions-%E9%85%8D%E7%BD%AE">GitHub Actions 配置</h2>
<p style="">在仓库根目录创建 <code>.github/workflows/deploy.yml</code> 文件，内容如下：</p>
<pre><code class="language-yaml">name: Deploy theme

on:
  push:
    branches:
      - main
    paths:
      - "**"
      - "!**.md"

permissions:
  contents: read

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v6

      - name: Setup pnpm
        uses: pnpm/action-setup@v5
        with:
          run_install: false

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: "24"
          cache: "pnpm"

      # 更新主题版本号，便于在控制台中识别当前运行的具体版本
      - name: Update theme version
        run: |
          SHORT_SHA="${GITHUB_SHA::7}"
          sed -i "s/^  version: .*/  version: 0.0.0-${SHORT_SHA}/" theme.yaml
          grep '^  version:' theme.yaml

      - name: Install dependencies
        run: pnpm install

      - name: Build distribution
        run: pnpm build

      - name: Upload artifact
        uses: actions/upload-artifact@v7
        with:
          # 替换为你的主题名称（metadata.name）
          name: theme-foo
          path: dist/*.zip
          retention-days: 7

      - name: Install Halo CLI
        run: npm install -g @halo-dev/cli

      - name: Upgrade theme via Halo CLI
        env:
          HALO_CLI_CONFIG_DIR: ${{ runner.temp }}/halo-cli
          HALO_TOKEN: ${{ secrets.HALO_TOKEN }}
          # 替换为你的主题名称（metadata.name）
          THEME_NAME: theme-foo
          # 替换为你的 Halo 站点地址
          HALO_URL: https://www.halo.run
        run: |
          THEME_ZIP="$(echo dist/*.zip)"

          if [ ! -f "$THEME_ZIP" ]; then
            echo "Theme zip file not found in dist/"
            exit 1
          fi

          halo auth login \
            --profile ci \
            --url "$HALO_URL" \
            --auth-type bearer \
            --token "$HALO_TOKEN"

          halo theme upgrade "$THEME_NAME" \
            --profile ci \
            --file "$THEME_ZIP"</code></pre>
<blockquote>
 <p style="">需要注意的是，此 Workflow 配置并不是固定的，这篇文章也只是提供一个思路，你可以根据自身需求进行调整，比如改为只有在创建新的 tag 时才部署。</p>
</blockquote>
<h2 style="" id="%E9%9C%80%E8%A6%81%E6%A0%B9%E6%8D%AE%E5%AE%9E%E9%99%85%E6%83%85%E5%86%B5%E4%BF%AE%E6%94%B9%E7%9A%84%E9%85%8D%E7%BD%AE">需要根据实际情况修改的配置</h2>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>配置项</th>
    <th>说明</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td><code>HALO_URL</code></td>
    <td>替换为你的 Halo 站点地址，例如 <code>https://www.example.com</code></td>
   </tr>
   <tr>
    <td><code>THEME_NAME</code></td>
    <td>替换为你的主题名称，需与 <code>theme.yaml</code> 中的 <code>metadata.name</code> 字段一致</td>
   </tr>
   <tr>
    <td><code>path: dist/*.zip</code></td>
    <td>如果你的构建产物路径不同，请相应修改</td>
   </tr>
   <tr>
    <td><code>node-version</code></td>
    <td>根据项目实际要求调整 Node.js 版本</td>
   </tr>
   <tr>
    <td><code>version</code> 中的前缀 <code>0.0.0</code></td>
    <td>随意填写，构建的时候会追加短 commit SHA 作为后缀</td>
   </tr>
  </tbody>
 </table>
</div>
<h2 style="" id="%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9">注意事项</h2>
<ul>
 <li>
  <p style=""><code>HALO_TOKEN</code> 是敏感信息，务必通过 GitHub Secrets 传入，不要硬编码在工作流文件中</p>
 </li>
 <li>
  <p style="">工作流中使用了 <code>HALO_CLI_CONFIG_DIR</code> 将 CLI 的配置目录隔离到 runner 临时目录，避免影响其他环境</p>
 </li>
 <li>
  <p style="">每次部署都会用 commit SHA 更新版本号，方便在控制台中识别当前运行的具体版本</p>
 </li>
 <li>
  <p style="">如果主题尚未安装到 Halo，需要先手动安装一次，后续再通过此工作流进行升级</p>
 </li>
</ul>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/theme-cd-github-actions</guid><dc:creator>Ryan Wang</dc:creator><category>运维</category><category>开发</category><pubDate>Thu, 16 Apr 2026 06:43:00 GMT</pubDate></item><item><title><![CDATA[使用页面缓存插件优化 Halo 网站速度]]></title><link>https://www.halo.run/archives/page-cache-plugin-optimization</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E4%BD%BF%E7%94%A8%E9%A1%B5%E9%9D%A2%E7%BC%93%E5%AD%98%E6%8F%92%E4%BB%B6%E4%BC%98%E5%8C%96%20Halo%20%E7%BD%91%E7%AB%99%E9%80%9F%E5%BA%A6&amp;url=/archives/page-cache-plugin-optimization" width="1" height="1" alt="" style="opacity:0;">
<p style=""><a href="https://www.halo.run/store/apps/app-BaamQ" target="_self" rel="">页面静态缓存</a>是面向 Halo 2 的插件，在服务端对已渲染的页面做静态缓存，减少重复计算与数据库访问，从而缩短<strong>未登录访客</strong>打开前台页面的时间。</p>
<p style="">它适合以文章、页面展示为主、访客大多未登录的博客或官网；与 CDN、图片压缩等手段可以叠加使用。若你还需要从整体上排查慢加载，可参考 <a href="https://www.halo.run/archives/website-loading-slow-troubleshooting" target="_self" rel="" class="ui-citation-link">网站加载速度慢，是什么问题导致的？</a>。</p>
<h2 style="" id="%E6%95%88%E6%9E%9C%E5%AF%B9%E6%AF%94">效果对比</h2>
<div class="columns" cols="2" style="display: flex;width: 100%;gap: 1em;">
 <div class="column" index="0" style="min-width: 0;flex: 1 1;box-sizing: border-box;">
  <figure data-content-type="image" style="display: flex; flex-direction: column;">
   <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fstore-resources%2FnmQKJKGneZKYfGICFnOKkOWnnbXBXzCr.jpg&amp;size=m" alt="Halo 启用页面静态缓存之前" width="3820px">
  </figure>
  <p style="text-align: center">启用前</p>
 </div>
 <div class="column" index="1" style="min-width: 0;flex: 1 1;box-sizing: border-box;">
  <figure data-content-type="image" style="display: flex; flex-direction: column;">
   <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fstore-resources%2FMHfGMiMPPVEJFRrqEPECWzASdRtlzclc.jpg&amp;size=m" alt="Halo 启用页面静态缓存之后" width="3820px">
  </figure>
  <p style="text-align: center">启用后</p>
 </div>
</div>
<h2 style="" id="%E5%AE%89%E8%A3%85%E4%B8%8E%E5%90%AF%E7%94%A8">安装与启用</h2>
<ol>
 <li>
  <p style="">在控制台打开<strong>应用市场</strong>，搜索 <strong>页面静态缓存</strong>，或打开应用详情页：<a href="https://www.halo.run/store/apps/app-BaamQ">页面静态缓存</a>；</p>
 </li>
 <li>
  <p style="">安装后<strong>启用</strong>插件即可，无需额外配置也会按默认策略开始工作。</p>
 </li>
</ol>
<h2 style="" id="%E9%BB%98%E8%AE%A4%E7%BC%93%E5%AD%98%E7%AD%96%E7%95%A5">默认缓存策略</h2>
<p style="">在默认设置下，行为如下：</p>
<ol>
 <li>
  <p style=""><strong>仅未登录访客</strong>访问前台页面时会<strong>生成</strong>缓存，已登录用户访问时<strong>不会写入</strong>缓存，也<strong>不会命中</strong>已有缓存。</p>
 </li>
 <li>
  <p style="">插件会<strong>监听文章内容变更</strong>并自动刷新相关缓存，如果站点上其他类型内容更新后需要立刻对所有访客生效，需要你在变更后<strong>手动清理缓存</strong>（见下文）。</p>
 </li>
</ol>
<h2 style="" id="%E3%80%8C%E6%80%BB%E6%98%AF%E7%BC%93%E5%AD%98%E3%80%8D%E9%80%89%E9%A1%B9%E8%AF%B4%E6%98%8E">「总是缓存」选项说明</h2>
<p style="">在插件设置中可以开启 <strong>总是缓存</strong>。开启后：</p>
<ul>
 <li>
  <p style="">已登录与未登录用户访问时<strong>都会使用</strong>已有缓存；</p>
 </li>
 <li>
  <p style="">但只有<strong>未登录</strong>访问时才会<strong>创建或更新</strong>缓存。</p>
 </li>
</ul>
<p style="">因此，若主题在页面 HTML 里直接渲染了「当前登录用户的昵称、头像」等数据，<strong>不建议</strong>开启该选项，否则用户登录后可能仍看到旧页面。</p>
<p style="">若业务上必须开启，建议把与用户相关的展示改为<strong>前端通过 API 异步加载</strong>，保证首屏 HTML 可被安全缓存。</p>
<h2 style="" id="%E6%89%8B%E5%8A%A8%E6%B8%85%E7%90%86%E7%BC%93%E5%AD%98">手动清理缓存</h2>
<p style="">当站点做了非文章类的更新、或需要立刻让全体访客看到最新前台效果时，可以手动刷新缓存：</p>
<p style="">在控制台 <strong>仪表盘</strong> 的<strong>快捷访问</strong>中，添加 <strong>刷新页面缓存</strong> 入口。</p>
<figure data-content-type="image" style="display: flex; flex-direction: column;">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fstore-resources%2FYCVNIxReWYGGwgYTucMOQwThZlqKjZZO.png&amp;size=m" alt="Halo 快捷访问清理页面缓存" width="100%" height="auto">
</figure>
<p style="">需要时点击 <strong>刷新页面缓存</strong>，即可清空当前页面缓存，后续访问会重新生成。</p>
<figure data-content-type="image" style="display: flex; flex-direction: column;">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fstore-resources%2FqhoHDxSuaJQZqcPuFiIOuvNVQOChZtQB.png&amp;size=m" alt="Halo 刷新页面缓存" width="100%" height="auto">
</figure>
<h2 style="" id="%E4%BD%BF%E7%94%A8%E4%B8%8A%E7%9A%84%E6%B3%A8%E6%84%8F%E7%82%B9">使用上的注意点</h2>
<ul>
 <li>
  <p style="">页面缓存减轻的是<strong>应用层渲染与读库压力</strong>，不能替代带宽、CDN、图片体积等优化。</p>
 </li>
 <li>
  <p style="">默认策略下，<strong>已登录用户</strong>始终走实时渲染，适合需要区分访客与管理员体验的场景。</p>
 </li>
 <li>
  <p style="">若站点强依赖实时数据，应评估是否启用、以及是否配合「总是缓存」与异步数据加载。</p>
 </li>
</ul>
<h2 style="" id="%E9%85%8D%E5%90%88-cdn-%E4%BD%BF%E7%94%A8">配合 CDN 使用</h2>
<p style="">此插件也可以配合 CDN 使用，利用 CDN 的节点缓存，可以让访客访问就近的节点，以获得更快的访问速度。与 CDN 配合使用通常无需额外配置，默认情况下，此插件会为已缓存的页面添加 <code>max-age=3, s-maxage=120, must-revalidate</code> 的响应头，CDN 会自动缓存这些页面，但需要注意的是：</p>
<ol>
 <li>
  <p style="">一定要在 CDN 中配置缓存策略为 <strong>遵循源站</strong>；</p>
 </li>
 <li>
  <p style="">在 Halo 侧清理缓存不会及时清理掉 CDN 的节点缓存，如果需要及时清理，需要在 CDN 侧手动清理。</p>
 </li>
</ol>
<p style="">有关 Halo 配置 CDN 的教程可参考：</p>
<ul>
 <li>
  <p style=""><a href="https://www.halo.run/archives/tencent-cloud-edge-one-website-acceleration">腾讯云 EdgeOne 接入 Halo 配置指南</a></p>
 </li>
 <li>
  <p style=""><a href="https://www.halo.run/archives/upyun-cdn-website-acceleration">又拍云 CDN 接入 Halo 配置指南</a></p>
 </li>
 <li>
  <p style=""><a href="https://www.halo.run/archives/qiniu-cdn-website-acceleration">七牛云 DCDN 接入 Halo 配置指南</a></p>
 </li>
 <li>
  <p style=""><a href="https://www.halo.run/archives/aliyun-esa-website-acceleration">阿里云 ESA 接入 Halo 配置指南</a></p>
 </li>
</ul>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/page-cache-plugin-optimization</guid><dc:creator>Ryan Wang</dc:creator><category>网站优化</category><pubDate>Wed, 15 Apr 2026 10:36:00 GMT</pubDate></item><item><title><![CDATA[阿里云 ESA 接入 Halo 配置指南]]></title><link>https://www.halo.run/archives/aliyun-esa-website-acceleration</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E9%98%BF%E9%87%8C%E4%BA%91%20ESA%20%E6%8E%A5%E5%85%A5%20Halo%20%E9%85%8D%E7%BD%AE%E6%8C%87%E5%8D%97&amp;url=/archives/aliyun-esa-website-acceleration" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%BB%80%E4%B9%88%E6%98%AF%E9%98%BF%E9%87%8C%E4%BA%91-esa%EF%BC%9F">什么是阿里云 ESA？</h2>
<p style=""><a href="https://www.aliyun.com/product/esa" target="_blank" rel="nofollow">阿里云边缘安全加速 ESA</a>是阿里云推出的全新一代边缘网络加速平台，整合了传统 CDN 的内容分发、DCDN 的全站加速，以及 DDoS 防护、WAF、Bot 管理、边缘计算等安全能力。相比前代产品，ESA 在全球节点覆盖、智能路由、安全原生防护和边缘 Serverless 能力上都有全面提升。</p>
<p style="">如果你此前使用的是阿里云 CDN 或 DCDN，阿里云官方已推荐将业务迁移至 ESA。ESA 与 DCDN、CDN 为相互独立的系统，你可以直接在 ESA 上重新部署站点并切换 DNS 解析生效，无需复杂的迁移操作。</p>
<h3 style="" id="cdn%E3%80%81dcdn-%E4%B8%8E-esa-%E7%9A%84%E5%8C%BA%E5%88%AB">CDN、DCDN 与 ESA 的区别</h3>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>能力</th>
    <th>CDN</th>
    <th>DCDN</th>
    <th>ESA</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>静态资源加速</td>
    <td>支持</td>
    <td>支持</td>
    <td>支持（含多级缓存、冷资源保持）</td>
   </tr>
   <tr>
    <td>动态请求加速</td>
    <td>不支持</td>
    <td>支持</td>
    <td>支持（智能路由优化）</td>
   </tr>
   <tr>
    <td>HTTPS 请求计费</td>
    <td>收费</td>
    <td>收费</td>
    <td>基础版/标准版/高级版不收费</td>
   </tr>
   <tr>
    <td>安全防护（WAF/DDoS）</td>
    <td>不支持</td>
    <td>基础能力</td>
    <td>原生集成，支持更细粒度规则</td>
   </tr>
   <tr>
    <td>DNS 托管</td>
    <td>不支持</td>
    <td>不支持</td>
    <td>支持</td>
   </tr>
   <tr>
    <td>边缘计算（函数/Pages）</td>
    <td>不支持</td>
    <td>仅边缘函数</td>
    <td>支持 Pages、容器、KV 存储</td>
   </tr>
   <tr>
    <td>接入方式</td>
    <td>单域名</td>
    <td>单域名</td>
    <td>站点化接入（支持子域名批量管理）</td>
   </tr>
  </tbody>
 </table>
</div>
<blockquote>
 <p style=""><strong>特别注意：请不要为 Halo 配置阿里云的 CDN 产品</strong>。传统 CDN 不支持 Halo 在使用的 <code>DELETE</code> 和 <code>PATCH</code> 等请求方式，会导致后台管理、文章保存、评论删除等操作失败。因此 Halo 站点至少需要使用支持动态加速的 DCDN 或 ESA。</p>
</blockquote>
<p style="">对于 Halo 站点来说，接入阿里云 ESA 的主要收益是：</p>
<ul>
 <li>
  <p style="">静态资源（图片、CSS、JS）由全球 3200+ 边缘节点就近响应，显著减少加载时间</p>
 </li>
 <li>
  <p style="">动态请求通过 Anycast 智能路由和协议优化回源，降低访问延迟</p>
 </li>
 <li>
  <p style="">原生集成 DDoS 和 WAF 防护，无需单独采购安全产品</p>
 </li>
 <li>
  <p style="">源站真实 IP 被隐藏，降低被直接攻击的风险</p>
 </li>
 <li>
  <p style="">HTTPS 请求数不额外计费，更适合全站 HTTPS 的站点</p>
 </li>
</ul>
<h2 style="" id="%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C">准备工作</h2>
<p style="">在开始之前，请确认以下条件已满足：</p>
<ul>
 <li>
  <p style=""><strong>Halo 站点正常运行</strong>：站点可以通过公网 IP 或已有域名正常访问</p>
 </li>
 <li>
  <p style=""><strong>域名已完成 ICP 备案</strong>：在中国大陆节点加速要求域名已备案</p>
 </li>
 <li>
  <p style=""><strong>已有阿里云账号</strong>并完成实名认证</p>
 </li>
</ul>
<h2 style="" id="%E6%B7%BB%E5%8A%A0%E7%AB%99%E7%82%B9%E5%B9%B6%E6%8E%A5%E5%85%A5%E5%9F%9F%E5%90%8D">添加站点并接入域名</h2>
<h3 style="" id="1.-%E7%99%BB%E5%BD%95-esa-%E6%8E%A7%E5%88%B6%E5%8F%B0">1. 登录 ESA 控制台</h3>
<p style="">访问 <a href="https://esa.console.aliyun.com" target="_blank" rel="nofollow">阿里云 ESA 控制台</a>，首次使用需要开通服务。开通后点击<strong>添加站点</strong>。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FVTJoplrsQKgmCANxHzaJxbIYXJFTKApV.png&amp;size=m" alt="阿里云 ESA 管理面板" width="100%" height="auto">
</figure>
<h3 style="" id="2.-%E8%BE%93%E5%85%A5%E7%AB%99%E7%82%B9%E5%9F%9F%E5%90%8D">2. 输入站点域名</h3>
<p style="">填写你的 Halo 站点<strong>主域名</strong>（例如 <code>example.com</code>），点击<strong>下一步</strong>。</p>
<blockquote>
 <p style="">推荐输入主域名，然后在 <strong>DNS → 记录</strong> 中为需要加速的子域添加记录并开启代理加速。</p>
</blockquote>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FBVCHYtQkpZvCfwtaolqoPhcobSLylscM.png&amp;size=m" alt="阿里云 ESA 添加站点" width="100%">
</figure>
<h3 style="" id="3.-%E9%80%89%E6%8B%A9%E5%A5%97%E9%A4%90">3. 选择套餐</h3>
<p style="">根据流量规模和功能需求选择合适的套餐：</p>
<ul>
 <li>
  <p style=""><strong>基础版</strong>：适合个人博客或小型站点，按流量计费</p>
 </li>
 <li>
  <p style=""><strong>标准版/高级版</strong>：适合中小型商业站点，包含更多安全规则和边缘计算额度</p>
 </li>
 <li>
  <p style=""><strong>企业版</strong>：大型站点定制方案</p>
 </li>
</ul>
<p style="">选择后勾选服务协议，点击<strong>下一步</strong>完成站点创建。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FGbhiYJSFmGzizcDWFBrFTUuFUwHKpChh.png&amp;size=m" alt="阿里云 ESA 选择套餐" width="100%">
</figure>
<h3 style="" id="4.-%E9%AA%8C%E8%AF%81%E5%9F%9F%E5%90%8D%E5%BD%92%E5%B1%9E%E6%9D%83">4. 验证域名归属权</h3>
<p style="">按照页面上的提示，在域名 DNS 服务商添加对应解析即可，配置完成之后，点击下方的 <strong>点击验证 </strong>按钮以测试是否配置正确。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FIVCxtxMuUCtpDUqyecQCiLEVLQesAhBJ.png&amp;size=m" alt="阿里云 ESA 验证域名归属权" width="100%">
</figure>
<h3 style="" id="5.-%E5%9C%A8-dns-%E8%AE%B0%E5%BD%95%E4%B8%AD%E6%B7%BB%E5%8A%A0%E5%8A%A0%E9%80%9F%E5%9F%9F%E5%90%8D">5. 在 DNS 记录中添加加速域名</h3>
<p style="">在 ESA 中，<strong>需要走边缘加速的具体子域名</strong>是在站点的 <strong>DNS → 记录</strong> 里添加的，而不是在单独的「域名管理」里新建一条站点外域名列表项。</p>
<ol>
 <li>
  <p style="">进入该站点左侧菜单 <strong>DNS → 记录</strong>，点击 <strong>添加记录</strong>。</p>
 </li>
 <li>
  <p style="">选择记录类型（常见为 <strong>A/AAAA</strong> 指向源站 IP，或由控制台引导选择 <strong>CNAME</strong> 等），填写<strong>主机记录</strong>（子域名前缀，如 <code>www</code> 或 <code>demo</code>）。</p>
 </li>
 <li>
  <p style="">打开 <strong>代理加速</strong>（代理状态为开启），这样该记录对应的访问流量才会经过 ESA 边缘网络；若关闭代理，则仅为普通 DNS 解析，不会获得加速与安全能力。</p>
 </li>
 <li>
  <p style="">填写<strong>记录值 / 源站</strong>（如服务器公网 IP 或源站域名）、<strong>回源协议</strong>建议选<strong>协议跟随</strong>；Halo 若未反代，回源端口一般为 <code>8090</code>，若前面已有 Nginx 反代到标准端口则按 <code>80</code>/<code>443</code> 填写。回源 Host 默认与请求 Host 一致即可，若有特殊回源需求可在 <strong>回源规则</strong> 中调整。</p>
 </li>
 <li>
  <p style="">向导中可能要求选择<strong>业务类型</strong>（如「网站页面」）、是否使用<strong>规则模板</strong>（缓存、压缩等）；对 Halo 可参考后文「边缘缓存规则」做一致或更细的调整。</p>
 </li>
 <li>
  <p style="">保存后，若使用 <strong>CNAME 接入</strong>，控制台会提示在<strong>域名解析服务商</strong>处添加 CNAME，把该子域名指向 ESA 给出的记录值；解析生效后访客才会真正从边缘访问。</p>
 </li>
</ol>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FhsIlDvkuJGgyrjyUaNQndIgudxfWKVdO.png&amp;size=m" alt="阿里云 ESA 添加 DNS 记录" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FZeJqxbKgwTpGLbRobhGIfIzfKosJDEHN.png&amp;size=m" alt="阿里云 ESA 选择网站类型" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FGEFdwcudSEAfFZoaCtMLfIiIGNJNgXaX.png&amp;size=m" alt="阿里云 ESA 配置 CNAME" width="100%">
</figure>
<h2 style="" id="%E9%85%8D%E7%BD%AE-https">配置 HTTPS</h2>
<p style="">在站点左侧打开 <strong>SSL/TLS → 边缘证书</strong>，进入 <strong>证书管理</strong> 区域，为已在 <strong>DNS → 记录</strong> 中接入代理加速的域名配置证书：</p>
<ol>
 <li>
  <p style="">点击 <strong>申请免费证书</strong>：按向导选择主机名（需与已添加的加速子域名一致），由平台自动签发与续期（例如 Let's Encrypt 免费证书），适合大多数 Halo 站点。</p>
 </li>
 <li>
  <p style="">或点击 <strong>上传自定义证书</strong>：自行上传证书与私钥；需在到期前手动更新并重新上传。</p>
 </li>
</ol>
<p style="">证书与主机名绑定并生效后，该域名即可通过 HTTPS 访问。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FyxxayggIwSpNxuIoJvyboEGrpmCbFeAP.png&amp;size=m" alt="阿里云 ESA 配置 SSL 证书" width="100%">
</figure>
<p style="">证书配置完成后，前往 Halo 控制台将<strong>外部访问地址</strong>更新为 <code>https://</code> 开头的地址（路径：<strong>控制台 → 概览 → 外部访问地址</strong>），否则页面中的静态资源链接可能仍生成 HTTP 地址，导致混合内容警告。</p>
<h2 style="" id="%E9%92%88%E5%AF%B9-halo-%E7%9A%84%E6%8E%A8%E8%8D%90%E9%85%8D%E7%BD%AE">针对 Halo 的推荐配置</h2>
<p style="">站点接入完成后，建议在 ESA 控制台中按以下说明调整配置，以获得更好的加速效果并确保 Halo 功能正常。</p>
<h3 style="" id="%E8%BE%B9%E7%BC%98%E7%BC%93%E5%AD%98%E8%A7%84%E5%88%99">边缘缓存规则</h3>
<p style="">进入 <strong>规则 → 缓存规则</strong> 页面，选择系统自动为我们创建的规则项，将 <strong>边缘缓存过期时间 </strong>选择为 <strong>优先遵循源站缓存策略（如果存在），否则不缓存。</strong></p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FuBTqqgnBZyEhWdqnvEhuTasMSwKlHPDd.png&amp;size=m" alt="阿里云 ESA 配置边缘缓存过期时间" width="100%">
</figure>
<p style="">将 <strong>查询字符串 </strong>选择为 <strong>全部保留</strong></p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FdXaTaJpLMusxsdpXMRbhMnMjxyScXjKJ.png&amp;size=m" alt="阿里云 ESA 配置查询字符串" width="100%">
</figure>
<h3 style="" id="%E9%80%9F%E5%BA%A6%E4%BC%98%E5%8C%96">速度优化</h3>
<p style="">在 <strong>速度和网络 → 优化</strong> 中可酌情开启：</p>
<ul>
 <li>
  <p style=""><strong>Gzip 压缩</strong> / <strong>Brotli 压缩</strong>：自动压缩文本类资源，减少传输体积</p>
 </li>
 <li>
  <p style=""><strong>HTTP/2</strong> 和 <strong>HTTP/3 (QUIC)</strong>：提升现代浏览器的访问性能</p>
 </li>
</ul>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FZGsZEOrVUKvzvdDbawUFXiBKISQCfeEY.png&amp;size=m" alt="阿里云 ESA 配置速度优化" width="100%">
</figure>
<h2 style="" id="%E9%AA%8C%E8%AF%81%E6%98%AF%E5%90%A6%E7%94%9F%E6%95%88">验证是否生效</h2>
<p style="">配置完成后，可以通过以下方式验证 ESA 是否正常工作：</p>
<ol>
 <li>
  <p style="">打开浏览器开发者工具，访问你的站点，在 Network 面板中查看静态资源的响应头；</p>
 </li>
 <li>
  <p style="">如果响应头中出现 <code>x-site-cache-status</code> 或 <code>server: ESA</code> 等阿里云特征头，说明资源已由边缘节点响应；</p>
 </li>
 <li>
  <p style="">使用 <a href="https://dnschecker.org/">DNS Checker</a> 验证域名解析是否已指向 ESA 节点。</p>
 </li>
</ol>
<h2 style="" id="%E9%85%8D%E5%90%88%E9%A1%B5%E9%9D%A2%E7%BC%93%E5%AD%98%E6%8F%92%E4%BB%B6">配合页面缓存插件</h2>
<p style="">在大多数情况下，CDN 对于静态资源通常有比较好的效果，但页面请求通常不会进行缓存，如果你期望对 Halo 的页面也在节点缓存，可以考虑配合静态页面缓存插件使用，详见：<a href="https://www.halo.run/archives/page-cache-plugin-optimization">使用页面缓存插件优化 Halo 网站速度</a></p>]]></description><guid isPermaLink="false">/archives/aliyun-esa-website-acceleration</guid><dc:creator>Ryan Wang</dc:creator><category>网站优化</category><pubDate>Wed, 15 Apr 2026 09:34:00 GMT</pubDate></item><item><title><![CDATA[在本地搭建 Halo 插件开发环境]]></title><link>https://www.halo.run/archives/setup-plugin-dev-environment</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%9C%A8%E6%9C%AC%E5%9C%B0%E6%90%AD%E5%BB%BA%20Halo%20%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83&amp;url=/archives/setup-plugin-dev-environment" width="1" height="1" alt="" style="opacity:0;">
<p style="">在本地开发 Halo 插件时，需要让 Halo 以<strong>开发模式</strong>加载你的插件项目。建议先用官方脚手架生成工程，再任选下面两种运行方式之一。</p>
<h2 style="" id="%E4%BD%BF%E7%94%A8%E8%84%9A%E6%89%8B%E6%9E%B6%E5%88%9B%E5%BB%BA%E6%8F%92%E4%BB%B6%E9%A1%B9%E7%9B%AE">使用脚手架创建插件项目</h2>
<p style="">官方提供 <a href="https://github.com/halo-dev/create-halo-plugin" target="_blank" rel="">create-halo-plugin</a> 脚手架，可在本机快速生成带 Gradle、前端构建与 DevTools 集成的插件模板。</p>
<p style=""><strong>前提条件</strong></p>
<ul>
 <li>
  <p style="">已安装 <a href="https://nodejs.org/" target="_blank" rel="">Node.js</a>（建议 LTS）与 <a href="https://pnpm.io/" target="_blank" rel="">pnpm</a></p>
 </li>
</ul>
<p style=""><strong>创建步骤</strong></p>
<p style="">在终端执行：</p>
<pre><code class="language-bash">pnpm create halo-plugin</code></pre>
<p style="">按交互提示填写即可，常见字段含义如下：</p>
<ul>
 <li>
  <p style=""><strong>Plugin name</strong>：插件标识，只能包含小写字母、数字和连字符</p>
 </li>
 <li>
  <p style=""><strong>Domain</strong>：用于 Java 包名与 <code>group</code> 的包域，例如 <code>com.example</code></p>
 </li>
 <li>
  <p style=""><strong>Author name</strong>：作者展示名</p>
 </li>
 <li>
  <p style=""><strong>Choose UI build tool</strong>：控制台前端构建工具，可选 <code>Rsbuild</code> 或 <code>Vite</code></p>
 </li>
</ul>
<p style="">命令结束后会生成一个独立目录，使用编辑器打开该目录即可开始开发。</p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E4%BD%BF%E7%94%A8-halo-gradle-%E6%8F%92%E4%BB%B6%EF%BC%88%E6%8E%A8%E8%8D%90%EF%BC%89">方式一：使用 Halo Gradle 插件（推荐）</h2>
<p style="">通过上述脚手架创建的项目已集成 <a href="https://docs.halo.run/developer-guide/plugin/basics/devtools" target="_blank" rel="" class="ui-citation-link">DevTools</a>。在插件项目根目录执行 <code>haloServer</code> 任务时，Gradle 会拉起一个用于插件开发的 Halo 容器，并把当前工程作为插件挂载进去。</p>
<p style=""><strong>前提条件</strong></p>
<ul>
 <li>
  <p style="">已安装 <strong>Docker</strong>（并保证 Docker 守护进程正在运行）</p>
  <ul>
   <li>
    <p style=""><strong>macOS</strong>：推荐安装 <a href="https://orbstack.dev/" target="_blank" rel="">OrbStack</a>（轻量、启动快）或 <a href="https://www.docker.com/products/docker-desktop/" target="_blank" rel="">Docker Desktop</a></p>
   </li>
   <li>
    <p style=""><strong>Windows</strong>：推荐安装 <a href="https://www.docker.com/products/docker-desktop/" target="_blank" rel="">Docker Desktop</a></p>
   </li>
   <li>
    <p style=""><strong>Linux</strong>：参考 <a href="https://docs.docker.com/engine/install/" target="_blank" rel="">Docker 官方安装文档</a></p>
   </li>
  </ul>
 </li>
 <li>
  <p style="">已安装 <strong>JDK 21</strong></p>
  <ul>
   <li>
    <p style=""><strong>macOS / Linux</strong></p>
    <pre><code class="language-shellscript"># 推荐使用 SDKMAN 管理 JDK 版本，如已安装可略过
curl -s "https://get.sdkman.io" | bash

# 安装 JDK 21
sdk install java 21-tem</code></pre>
   </li>
   <li>
    <p style=""><strong>Windows</strong></p>
    <p style="">前往 <a href="https://adoptium.net/" target="_blank" rel="">https://adoptium.net</a> 下载 JDK 21 安装包，按向导安装即可。</p>
   </li>
  </ul>
 </li>
</ul>
<p style=""><strong>步骤</strong></p>
<p style="">在插件项目根目录执行：</p>
<pre><code class="language-shell"> # macOS / Linux
 ./gradlew haloServer

 # Windows
 ./gradlew.bat haloServer</code></pre>
<p style="">首次拉取镜像可能需要一些时间。启动成功后，控制台会打印默认访问地址与账号密码，例如：</p>
<pre><code class="language-shellscript"> Halo 初始化成功，访问：http://localhost:8090/console
 用户名：admin
 密码：admin</code></pre>
<p style="">浏览器打开控制台，在插件列表中应能看到当前插件已加载；修改代码后按 DevTools 文档说明进行热更新或重新构建即可。</p>
<p style="">该方式不需要在本机单独克隆、编译 Halo 主仓库，环境一致性好，适合绝大多数插件开发场景。</p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E6%9C%AC%E5%9C%B0%E8%BF%90%E8%A1%8C-halo-%E6%BA%90%E7%A0%81%E5%B9%B6%E6%8C%87%E5%AE%9A%E6%8F%92%E4%BB%B6%E7%9B%AE%E5%BD%95">方式二：本地运行 Halo 源码并指定插件目录</h2>
<p style="">当本机无法使用 Docker，或你需要同时调试 Halo 核心与插件行为时，可以在本地从源码启动 Halo，并通过配置把插件目录固定为开发路径。</p>
<p style=""><strong>前提条件</strong></p>
<ul>
 <li>
  <p style="">已按 <a href="https://docs.halo.run/developer-guide/core/run" target="_blank" rel="" class="ui-citation-link">Halo 开发环境运行</a> 在本机成功运行 Halo 源码工程</p>
 </li>
 <li>
  <p style="">已有一个可用的插件项目（通常由脚手架创建），且能通过 <code>./gradlew build</code> 正常产出插件包</p>
 </li>
</ul>
<p style=""><strong>步骤</strong></p>
<p style="">在插件项目中先完成一次构建：</p>
<pre><code class="language-shell"> # macOS / Linux
 ./gradlew build

 # Windows
 ./gradlew.bat build</code></pre>
<p style="">在 Halo 工程 <code>application/src/main/resources</code> 下创建或编辑 <code>application-local.yaml</code>，增加插件开发模式与固定路径（路径改为你的插件项目<strong>根目录</strong>的绝对路径）：</p>
<pre><code class="language-yaml"> halo:
   plugin:
     runtime-mode: development
     fixed-plugin-path:
       - /path/to/your-plugin-project</code></pre>
<p style="">Windows 示例：</p>
<pre><code class="language-yaml">halo:
  plugin:
    runtime-mode: development
    fixed-plugin-path:
      - C:\path\to\your-plugin-project</code></pre>
<p style="">在 Halo 仓库根目录启动（与官方文档中的 profile 保持一致）：</p>
<pre><code class="language-shell"># macOS / Linux
./gradlew bootRun --args="--spring.profiles.active=dev,local"

# Windows
gradlew.bat bootRun --args="--spring.profiles.active=dev,win,local"</code></pre>
<p style="">访问 <code>http://localhost:8090/console</code>，确认插件已出现在插件列表中且功能正常。</p>
<h2 style="" id="%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9">如何选择</h2>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>方式</th>
    <th>优点</th>
    <th>适用场景</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>Gradle <code>haloServer</code></td>
    <td>无需维护 Halo 源码；环境与官方容器一致；上手快</td>
    <td>日常插件功能与 UI 开发（推荐默认）</td>
   </tr>
   <tr>
    <td>Halo 源码 + <code>fixed-plugin-path</code></td>
    <td>可调试核心与插件联动；不依赖 Docker</td>
    <td>无法使用 Docker，或需要修改/调试 Halo 本体</td>
   </tr>
  </tbody>
 </table>
</div>
<p style="">更多关于 Halo 插件开发的文档可查阅：<a href="https://docs.halo.run/category/%E6%8F%92%E4%BB%B6%E5%BC%80%E5%8F%91" target="_blank" rel="">Halo 文档 - 插件开发</a></p>]]></description><guid isPermaLink="false">/archives/setup-plugin-dev-environment</guid><dc:creator>Ryan Wang</dc:creator><category>开发</category><pubDate>Wed, 15 Apr 2026 04:53:00 GMT</pubDate></item><item><title><![CDATA[七牛云 DCDN 接入 Halo 配置指南]]></title><link>https://www.halo.run/archives/qiniu-cdn-website-acceleration</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E4%B8%83%E7%89%9B%E4%BA%91%20DCDN%20%E6%8E%A5%E5%85%A5%20Halo%20%E9%85%8D%E7%BD%AE%E6%8C%87%E5%8D%97&amp;url=/archives/qiniu-cdn-website-acceleration" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%BB%80%E4%B9%88%E6%98%AF%E4%B8%83%E7%89%9B%E4%BA%91%E5%85%A8%E7%AB%99%E5%8A%A0%E9%80%9F%EF%BC%88dcdn%EF%BC%89%EF%BC%9F">什么是七牛云全站加速（DCDN）？</h2>
<p style=""><a href="https://www.qiniu.com/products/dcdn" target="_blank" rel="">七牛云 DCDN</a> 是七牛云提供的一体化动态内容加速产品，覆盖国内外众多节点，支持静态加速、动态加速、HTTPS、缓存刷新等功能。相比传统 CDN 只能加速静态资源，DCDN 通过智能路由和私有协议优化，对动态请求（如页面动态内容）也有明显的加速效果，更适合 Halo 这类动静态内容混合的站点。</p>
<p style="">对于 Halo 站点来说，接入七牛云 DCDN 的主要收益是：</p>
<ul>
 <li>
  <p style="">静态资源由就近节点直接响应，减少加载时间</p>
 </li>
 <li>
  <p style="">动态请求通过优化链路回源，降低全球访问延迟</p>
 </li>
 <li>
  <p style="">回源流量减少，降低源站带宽压力</p>
 </li>
 <li>
  <p style="">源站真实 IP 被隐藏，降低被直接攻击的风险</p>
 </li>
</ul>
<h2 style="" id="%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C">准备工作</h2>
<p style="">在开始之前，请确认以下条件已满足：</p>
<ul>
 <li>
  <p style=""><strong>Halo 站点正常运行</strong>：站点可以通过公网 IP 或已有域名正常访问</p>
 </li>
 <li>
  <p style=""><strong>域名已完成 ICP 备案</strong>：在中国大陆节点加速要求域名已备案</p>
 </li>
 <li>
  <p style=""><strong>已有七牛云账号</strong>并完成实名认证</p>
 </li>
</ul>
<h2 style="" id="%E6%B7%BB%E5%8A%A0%E5%8A%A0%E9%80%9F%E5%9F%9F%E5%90%8D">添加加速域名</h2>
<p style="">登录 <a href="https://portal.qiniu.com/dcdn/domain" target="_blank" rel="">七牛云控制台</a>，进入<strong>全站加速 → 域名管理</strong>，点击<strong>添加域名</strong></p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FcJTYQYDntnxaJHdhFWzsZFOsnvhqQjSj.png&amp;size=m" alt="七牛云 CDN 添加域名" width="100%" height="auto">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FkhnUOZFvGUqoOtlMaMDhhJDXqxhvhdKU.png&amp;size=m" alt="七牛云 CDN 添加域名 - 缓存配置" width="100%">
</figure>
<p style="">填写<strong>基本信息</strong>：</p>
<ul>
 <li>
  <p style=""><strong>加速域名</strong>：填写需要加速的域名，例如 <code>www.example.com</code></p>
 </li>
 <li>
  <p style=""><strong>通信协议</strong>：先选择 <strong>HTTP</strong>，待域名创建完成后再到 HTTPS 配置中开启</p>
 </li>
 <li>
  <p style=""><strong>覆盖范围</strong>：根据访客分布选择，国内用户为主选择<strong>中国大陆</strong>（域名需已备案）</p>
 </li>
 <li>
  <p style=""><strong>IP 协议</strong>：选择 <strong>IPv4/IPv6</strong></p>
 </li>
</ul>
<p style="">填写<strong>源站配置</strong>：</p>
<ul>
 <li>
  <p style=""><strong>源站配置</strong>：选择 <strong>IP 地址</strong>，填写服务器的公网 IP</p>
 </li>
 <li>
  <p style=""><strong>回源 HOST</strong>：选择<strong>加速域名</strong></p>
 </li>
 <li>
  <p style=""><strong>回源协议</strong>：选择<strong>遵循请求协议</strong></p>
 </li>
</ul>
<p style="">在<strong>缓存配置</strong>部分：</p>
<ul>
 <li>
  <p style="">开启<strong>静态缓存规则</strong>，点击<strong>使用推荐配置</strong>，系统会自动填充常见静态资源的缓存规则，例如图片缓存 1 天、视频文件缓存 7 天等</p>
 </li>
 <li>
  <p style=""><strong>缓存参数</strong>：选择<strong>保留所有参数</strong></p>
 </li>
</ul>
<p style="">点击<strong>创建</strong>，页面会跳转到域名详情，提示需要完成<strong>域名所有权验证</strong>。</p>
<h2 style="" id="%E5%9F%9F%E5%90%8D%E6%89%80%E6%9C%89%E6%9D%83%E9%AA%8C%E8%AF%81">域名所有权验证</h2>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FgfRTgQCPNYTpmDdJACrgmFERDDLJetEo.png&amp;size=m" alt="七牛云 CDN 验证域名所有权" width="100%">
</figure>
<p style="">创建域名后，七牛云会要求验证域名归属权，以防止恶意接入他人域名。验证方式为 DNS 解析验证：</p>
<ol>
 <li>
  <p style="">在弹出的<strong>域名所有权验证</strong>面板中，可以看到需要添加的 TXT 记录：</p>
  <div class="markdown-edited">
   <table>
    <thead>
     <tr>
      <th>记录类型</th>
      <th>主机记录</th>
      <th>记录值</th>
     </tr>
    </thead>
    <tbody>
     <tr>
      <td>TXT</td>
      <td><code>verification</code></td>
      <td><code>verify_xxxxxxxxxx</code></td>
     </tr>
    </tbody>
   </table>
  </div>
 </li>
 <li>
  <p style="">前往你的 DNS 服务商，添加上述 TXT 记录；</p>
 </li>
 <li>
  <p style="">记录添加完成后，回到七牛云控制台，点击<strong>点击验证</strong>完成验证；</p>
 </li>
 <li>
  <p style="">验证通过后，再根据提示配置 CNAME 记录以正式启用 CDN 服务。</p>
 </li>
</ol>
<h2 style="" id="%E9%85%8D%E7%BD%AE-cname">配置 CNAME</h2>
<figure data-content-type="image" style="display: flex; flex-direction: column;">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FRgJVlNUvegamhHTfrcXzflXdOriJRGze.png&amp;size=m" alt="七牛云 CDN 配置 CNAME" width="100%">
</figure>
<ol>
 <li>
  <p style="">域名创建后，在域名详情页的<strong>基本信息</strong>中可以找到系统分配的 CNAME 地址；</p>
 </li>
 <li>
  <p style="">前往你的 DNS 服务商，为加速域名添加一条 CNAME 记录，记录值填入上述 CNAME 地址；</p>
 </li>
 <li>
  <p style="">等待 DNS 解析生效（通常几分钟内完成）。</p>
 </li>
</ol>
<h2 style="" id="%E7%94%B3%E8%AF%B7-ssl-%E8%AF%81%E4%B9%A6">申请 SSL 证书</h2>
<p style="">如果你还没有 SSL 证书，可以在七牛云证书服务中申请免费证书：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FNPbetjCAAdLcsYxZgCMZffJcHDYmTmUq.png&amp;size=m" alt="七牛云 CDN 申请证书" width="100%">
</figure>
<ol>
 <li>
  <p style="">进入 <a href="https://portal.qiniu.com/certificate/apply" target="_blank" rel="">七牛云证书管理</a>，点击<strong>购买证书</strong>；</p>
 </li>
 <li>
  <p style="">证书品牌选择 <strong>TrustAsia</strong>，证书种类选择 <strong>DV 免费域名型</strong>，费用为 ¥0.00，点击<strong>核对信息并支付</strong>；</p>
 </li>
</ol>
<ol start="3">
 <li>
  <p style="">在<strong>补全信息</strong>页面中填写：</p>
  <ul>
   <li>
    <p style=""><strong>域名</strong>：填写需要申请证书的加速域名</p>
   </li>
   <li>
    <p style=""><strong>证书备注名</strong>：可与域名保持一致，方便识别</p>
   </li>
   <li>
    <p style=""><strong>域名所有权验证方式</strong>：选择 <strong>DNS 验证</strong></p>
   </li>
   <li>
    <p style=""><strong>加密算法</strong>：选择 <strong>RSA</strong></p>
   </li>
  </ul>
 </li>
 <li>
  <p style="">按照页面提示，在 DNS 服务商添加指定的 TXT 记录完成域名验证，证书签发后即可使用。</p>
 </li>
</ol>
<h2 style="" id="%E9%85%8D%E7%BD%AE-https">配置 HTTPS</h2>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FamZaJKneBrkOyArLzlejgSLEQszEWKXz.png&amp;size=m" alt="七牛云 CDN 配置 HTTPS" width="100%">
</figure>
<ol>
 <li>
  <p style="">在域名详情页找到 <strong>HTTPS 配置</strong>，点击修改，打开配置面板；</p>
 </li>
 <li>
  <p style="">开启 HTTPS，在<strong>已有证书</strong>标签下选择之前申请的免费证书；</p>
  <p style="">如未提前申请，可点击页面中的<strong>七牛云证书服务</strong>链接，前往申请后再回来绑定。</p>
 </li>
 <li>
  <p style="">根据需要开启以下选项：</p>
  <ul>
   <li>
    <p style=""><strong>强制 HTTPS</strong>：开启后所有 HTTP 请求将自动跳转到 HTTPS</p>
   </li>
   <li>
    <p style=""><strong>HTTP/2 访问</strong>：开启可提升 HTTPS 下的访问性能</p>
   </li>
  </ul>
 </li>
 <li>
  <p style="">点击<strong>确定</strong>保存配置；</p>
 </li>
 <li>
  <p style="">证书配置完成后，同步在 Halo 控制台将外部访问地址更新为 <code>https://</code> 开头（路径：<strong>控制台 → 概览 → 外部访问地址</strong>）。</p>
 </li>
</ol>
<h2 style="" id="%E9%AA%8C%E8%AF%81%E6%98%AF%E5%90%A6%E7%94%9F%E6%95%88">验证是否生效</h2>
<p style="">配置完成后，可以通过以下方式验证：</p>
<ol>
 <li>
  <p style="">打开浏览器开发者工具，访问你的站点，在 Network 面板中查看静态资源的响应头；</p>
 </li>
 <li>
  <p style="">如果响应头中出现 <code>x-dsa-trace-id</code> 或 <code>server: volc-dcdn</code>，说明资源已由边缘节点响应；</p>
 </li>
 <li>
  <p style="">使用 <a href="https://dnschecker.org/">DNS Checker</a> 验证域名解析是否已指向 CDN 节点。</p>
 </li>
</ol>
<h2 style="" id="%E9%85%8D%E5%90%88%E9%A1%B5%E9%9D%A2%E7%BC%93%E5%AD%98%E6%8F%92%E4%BB%B6">配合页面缓存插件</h2>
<p style="">在大多数情况下，CDN 对于静态资源通常有比较好的效果，但页面请求通常不会进行缓存，如果你期望对 Halo 的页面也在节点缓存，可以考虑配合静态页面缓存插件使用，详见：<a href="https://www.halo.run/archives/page-cache-plugin-optimization">使用页面缓存插件优化 Halo 网站速度</a></p>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/qiniu-cdn-website-acceleration</guid><dc:creator>Ryan Wang</dc:creator><category>网站优化</category><pubDate>Tue, 14 Apr 2026 12:08:00 GMT</pubDate></item><item><title><![CDATA[如何一键更新 Halo 的主题和插件]]></title><link>https://www.halo.run/archives/how-to-update-halo-themes-and-plugins</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%A6%82%E4%BD%95%E4%B8%80%E9%94%AE%E6%9B%B4%E6%96%B0%20Halo%20%E7%9A%84%E4%B8%BB%E9%A2%98%E5%92%8C%E6%8F%92%E4%BB%B6&amp;url=/archives/how-to-update-halo-themes-and-plugins" width="1" height="1" alt="" style="opacity:0;">
<p style="">Halo 提供了两种方式批量更新已安装的主题和插件，无需逐个手动操作。</p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E9%80%9A%E8%BF%87%E5%BA%94%E7%94%A8%E5%B8%82%E5%9C%BA%E6%8F%92%E4%BB%B6">方式一：通过应用市场插件</h2>
<p style="">安装最新版本的<a href="https://www.halo.run/store/apps/app-VYJoB">应用市场插件</a>后，控制台中会新增<strong>应用市场</strong>模块，其中包含<strong>更新应用</strong>页面。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FNotrZxzZbvxrlVTmfhXZQvsLbdBVbqdH.png&amp;size=m" alt="Halo 应用市场一键升级" width="100%" height="auto">
</figure>
<ol>
 <li>
  <p style="">在控制台菜单中点击<strong>应用市场</strong>，进入<strong>更新应用</strong>页面；</p>
 </li>
 <li>
  <p style="">页面会列出所有当前有可用更新的主题和插件；</p>
 </li>
 <li>
  <p style="">可以逐个点击更新，也可以点击页面右上角的<strong>全部更新</strong>按钮，一键完成所有更新。</p>
 </li>
</ol>
<p style="">这种方式操作直观，适合日常维护使用。</p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E9%80%9A%E8%BF%87-halo-cli">方式二：通过 Halo CLI</h2>
<p style=""><a href="https://github.com/halo-dev/cli" target="_blank" rel="nofollow">Halo CLI</a> 支持通过命令行批量升级主题和插件，适合熟悉命令行操作或需要在脚本中自动化更新的场景。</p>
<p style=""><strong>升级所有插件：</strong></p>
<pre><code class="language-bash">halo plugin upgrade --all</code></pre>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FjyzUQrOulKyZrpGIimsrXUftrMoqQDsM.png&amp;size=m" alt="通过 Halo CLI 升级插件" width="100%">
</figure>
<p style=""><strong>升级所有主题：</strong></p>
<pre><code class="language-bash">halo theme upgrade --all</code></pre>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FliswXSouJGBwAXdhhRupRyOOltkjlqVj.png&amp;size=m" alt="通过 Halo CLI 升级主题" width="100%">
</figure>
<p style="">如果只需要升级某个特定的主题或插件，也可以指定名称：</p>
<pre><code class="language-bash">halo plugin upgrade &lt;plugin-name&gt;
halo theme upgrade &lt;theme-name&gt;</code></pre>
<p style="">关于 Halo CLI 的安装和配置，请参考 <a href="https://github.com/halo-dev/cli" target="_blank" rel="nofollow">Halo CLI 文档</a>。</p>]]></description><guid isPermaLink="false">/archives/how-to-update-halo-themes-and-plugins</guid><dc:creator>Ryan Wang</dc:creator><category>使用技巧</category><pubDate>Tue, 14 Apr 2026 08:25:19 GMT</pubDate></item><item><title><![CDATA[又拍云 CDN 接入 Halo 配置指南]]></title><link>https://www.halo.run/archives/upyun-cdn-website-acceleration</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%8F%88%E6%8B%8D%E4%BA%91%20CDN%20%E6%8E%A5%E5%85%A5%20Halo%20%E9%85%8D%E7%BD%AE%E6%8C%87%E5%8D%97&amp;url=/archives/upyun-cdn-website-acceleration" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%BB%80%E4%B9%88%E6%98%AF%E5%8F%88%E6%8B%8D%E4%BA%91-cdn%EF%BC%9F">什么是又拍云 CDN？</h2>
<p style=""><a href="https://console.upyun.com/register/?invite=rJohz0KO-">又拍云</a> 是一家以 CDN 为核心业务的云服务商，提供静态加速、动态加速、全站加速、图片处理等服务。又拍云价格相对实惠，提供流量包计费方式，对于中小型站点较为友好。</p>
<p style="">对于 Halo 站点来说，接入又拍云 CDN 的主要收益是：</p>
<ul>
 <li>
  <p style="">静态资源由就近节点直接响应，减少加载时间</p>
 </li>
 <li>
  <p style="">回源流量减少，降低源站带宽压力</p>
 </li>
 <li>
  <p style="">源站真实 IP 被隐藏，降低被直接攻击的风险</p>
 </li>
</ul>
<h2 style="" id="%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C">准备工作</h2>
<p style="">在开始之前，请确认以下条件已满足：</p>
<ul>
 <li>
  <p style=""><strong>Halo 站点正常运行</strong>：站点可以通过公网 IP 或已有域名正常访问</p>
 </li>
 <li>
  <p style=""><strong>域名已完成 ICP 备案</strong>：在中国大陆节点加速要求域名已备案</p>
 </li>
 <li>
  <p style=""><strong>已有又拍云账号</strong>并完成实名认证</p>
 </li>
</ul>
<h2 style="" id="%E5%88%9B%E5%BB%BA%E6%9C%8D%E5%8A%A1%E5%B9%B6%E7%BB%91%E5%AE%9A%E5%9F%9F%E5%90%8D">创建服务并绑定域名</h2>
<p style="">登录 <a href="https://console.upyun.com/services/cdn/">又拍云控制台</a>，进入 <strong>CDN 加速 → 服务管理</strong>，点击<strong>创建服务</strong></p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FJVWcTEEglYelyAohgyptdeNOUIKIUStD.png&amp;size=m" alt="又拍云 CDN" width="100%" height="auto">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FoJuJarOiEYqSJyxCXBICvzrRHZzDENBJ.png&amp;size=m" alt="又拍云创建 CDN 服务" width="100%">
</figure>
<p style="">填写服务名称和加速域名后，如果该域名尚未在又拍云验证过归属权，页面会提示需要先完成 DNS 验证：</p>
<ul>
 <li>
  <p style="">前往你的 DNS 服务商，添加一条 <strong>TXT 记录</strong>：</p>
  <ul>
   <li>
    <p style=""><strong>主机记录</strong>：<code>upyun-verify</code></p>
   </li>
   <li>
    <p style=""><strong>记录类型</strong>：<code>TXT</code></p>
   </li>
   <li>
    <p style=""><strong>记录值</strong>：页面上显示的验证值</p>
   </li>
  </ul>
 </li>
 <li>
  <p style="">添加完成后，点击<strong>验证</strong>，通过后即可继续创建服务。</p>
 </li>
</ul>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FtZyXRcSQMNMccjOtfHMmivBRzraSsqEO.png&amp;size=m" alt="又拍云 CDN 配置源站" width="100%">
</figure>
<p style="">继续填写以下配置：</p>
<ul>
 <li>
  <p style=""><strong>应用场景</strong>：选择<strong>全站加速</strong>（兼顾动静态内容）</p>
 </li>
 <li>
  <p style=""><strong>源站设置</strong>：</p>
  <ul>
   <li>
    <p style="">回源协议：选择 <strong>HTTP</strong> 或 <strong>HTTPS</strong></p>
   </li>
   <li>
    <p style="">线路配置：填写服务器公网 IP 地址和端口号，如果你服务器没有配置 Nginx 反向代理，可以直接填写 Halo 服务的端口号，如果已经配置过 Nginx 反向代理和 SSL 证书，那么可以选择协议跟随</p>
   </li>
  </ul>
 </li>
</ul>
<p style="">点击<strong>确定创建</strong>，系统会为该服务分配一个 CNAME 地址：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FGRiNYkjRFgEdanMFFVYHqVNWsZINXTwZ.png&amp;size=m" alt="又拍云 CDN 配置 CNAME" width="100%">
</figure>
<p style="">前往你的 DNS 服务商，为加速域名添加一条 CNAME 记录，记录值为上一步分配的 CNAME 地址，等待解析生效。</p>
<h2 style="" id="%E9%85%8D%E7%BD%AE-https">配置 HTTPS</h2>
<p style="">进入功能配置，切换到 <strong>HTTPS</strong> 标签</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FdpaubzVExtlgMseAzqUaEMCKsuzjUUCC.png&amp;size=m" alt="又拍云 CDN 配置 SSL 证书" width="100%">
</figure>
<p style="">你可以选择 <strong>添加自有证书 </strong>或者去证书管理页面申请免费证书，如需申请免费证书，可在 <strong>证书管理</strong> 中申请 Let's Encrypt 免费证书，申请完成后回到此处绑定。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FCtfopODsbAwOPngHIPDVfgXECaZRPker.png&amp;size=m" alt="又拍云 CDN 申请 SSL 证书" width="100%">
</figure>
<p style="">开启<strong>强制 HTTPS</strong>，将所有 HTTP 请求重定向到 HTTPS</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FLjRldMAYPiYJUaxEalFzVLTTpZitmQUb.png&amp;size=m" alt="又拍云 CDN HTTPS 配置" width="100%">
</figure>
<p style="">证书配置完成后，同步更新 Halo 控制台的外部访问地址为 <code>https://</code> 开头（路径：<strong>控制台 → 概览 → 外部访问地址</strong>）。</p>
<h2 style="" id="%E9%92%88%E5%AF%B9-halo-%E7%9A%84%E6%8E%A8%E8%8D%90%E9%85%8D%E7%BD%AE">针对 Halo 的推荐配置</h2>
<h3 style="" id="%E5%8F%82%E6%95%B0%E8%B7%9F%E9%9A%8F">参数跟随</h3>
<p style="">进入 <strong>功能配置 → 缓存控制</strong> 页面：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FzMMKMHictFXALNLXKNYaFdpzPVTuPCBE.png&amp;size=m" alt="又拍云 CDN 参数跟随配置" width="100%">
</figure>
<p style="">将参数跟随设置为<strong>全程跟随</strong>。Halo 的部分请求（API、附件下载等）依赖 URL 中 <code>?</code> 后的查询参数，全程跟随可以确保这些参数完整传递到源站，避免请求异常。</p>
<h3 style="" id="%E9%87%8D%E5%AE%9A%E5%90%91%E8%B7%9F%E9%9A%8F">重定向跟随</h3>
<p style="">进入 <strong>功能配置 → 性能优化</strong> 页面：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FBsGXXMEEJFfsnSLVbUmBEKcUbnQMOGPh.png&amp;size=m" alt="又拍云 CDN 重定向跟随配置" width="100%">
</figure>
<p style="">保持<strong>关闭</strong>状态。Halo 自身会处理必要的跳转逻辑，如果 CDN 节点在回源时自动跟随重定向，可能会导致跳转行为异常，建议不要开启。</p>
<h2 style="" id="%E9%AA%8C%E8%AF%81%E6%98%AF%E5%90%A6%E7%94%9F%E6%95%88">验证是否生效</h2>
<p style="">配置完成后，可以通过以下方式验证：</p>
<ol>
 <li>
  <p style="">打开浏览器开发者工具，访问你的站点，在 Network 面板中查看静态资源的响应头；</p>
 </li>
 <li>
  <p style="">如果响应头中出现 <code>x-request-id</code> 或 <code>server: marco/3.2</code> 等又拍云特征头，说明资源已由边缘节点响应；</p>
 </li>
 <li>
  <p style="">使用 <a href="https://dnschecker.org/">DNS Checker</a> 验证域名解析是否已指向 CDN 节点。</p>
 </li>
</ol>
<h2 style="" id="%E9%85%8D%E5%90%88%E9%A1%B5%E9%9D%A2%E7%BC%93%E5%AD%98%E6%8F%92%E4%BB%B6">配合页面缓存插件</h2>
<p style="">在大多数情况下，CDN 对于静态资源通常有比较好的效果，但页面请求通常不会进行缓存，如果你期望对 Halo 的页面也在节点缓存，可以考虑配合静态页面缓存插件使用，详见：<a href="https://www.halo.run/archives/page-cache-plugin-optimization">使用页面缓存插件优化 Halo 网站速度</a></p>]]></description><guid isPermaLink="false">/archives/upyun-cdn-website-acceleration</guid><dc:creator>Ryan Wang</dc:creator><category>网站优化</category><pubDate>Tue, 14 Apr 2026 04:34:50 GMT</pubDate></item><item><title><![CDATA[腾讯云 EdgeOne 接入 Halo 配置指南]]></title><link>https://www.halo.run/archives/tencent-cloud-edge-one-website-acceleration</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E8%85%BE%E8%AE%AF%E4%BA%91%20EdgeOne%20%E6%8E%A5%E5%85%A5%20Halo%20%E9%85%8D%E7%BD%AE%E6%8C%87%E5%8D%97&amp;url=/archives/tencent-cloud-edge-one-website-acceleration" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%BB%80%E4%B9%88%E6%98%AF%E8%85%BE%E8%AE%AF%E4%BA%91-edgeone%EF%BC%9F">什么是腾讯云 EdgeOne？</h2>
<p style=""><a href="https://www.tencentcloud.com/zh/products/teo" target="_blank" rel="">腾讯云 EdgeOne</a>（边缘安全加速平台 EO）是腾讯云推出的一体化边缘安全加速平台，将 CDN 加速、DDoS 防护、WAF、Bot 管理、边缘函数等能力集成在同一平台中，无需多个产品叠加使用。</p>
<p style="">对于 Halo 站点来说，接入 EdgeOne 的主要收益是：</p>
<ul>
 <li>
  <p style="">静态资源（图片、CSS、JS）由就近的边缘节点直接响应，减少加载时间</p>
 </li>
 <li>
  <p style="">回源流量减少，降低源站带宽压力</p>
 </li>
 <li>
  <p style="">源站真实 IP 被隐藏，降低源站遭受直接攻击的风险</p>
 </li>
 <li>
  <p style="">无需单独采购 DDoS 防护和 WAF，安全与加速一体化</p>
 </li>
</ul>
<h2 style="" id="%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C">准备工作</h2>
<p style="">在开始之前，请确认以下条件已满足：</p>
<ul>
 <li>
  <p style=""><strong>Halo 站点正常运行</strong>：站点可以通过公网 IP 或已有域名正常访问</p>
 </li>
 <li>
  <p style=""><strong>域名已完成 ICP 备案</strong>：接入中国大陆节点要求域名在工信部完成备案，若只接入海外节点则不要求</p>
 </li>
 <li>
  <p style=""><strong>已有腾讯云账号</strong>并完成实名认证</p>
 </li>
</ul>
<h2 style="" id="%E5%9C%A8-edgeone-%E6%B7%BB%E5%8A%A0%E7%AB%99%E7%82%B9%E5%B9%B6%E6%8E%A5%E5%85%A5">在 EdgeOne 添加站点并接入</h2>
<h3 style="" id="1.-%E7%99%BB%E5%BD%95-edgeone-%E6%8E%A7%E5%88%B6%E5%8F%B0">1. 登录 EdgeOne 控制台</h3>
<p style="">访问 <a href="https://console.cloud.tencent.com/edgeone" target="_blank" rel="">边缘安全加速平台 EO 控制台</a>，首次使用时会进入场景选择页面，点击<strong>添加站点</strong>。</p>
<h3 style="" id="2.-%E5%A1%AB%E5%86%99%E7%AB%99%E7%82%B9%E5%9F%9F%E5%90%8D">2. 填写站点域名</h3>
<p style="">输入你的 Halo 站点的<strong>主域名</strong>（例如 <code>example.com</code>），点击<strong>开始接入</strong>。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FBWHmnMdSbZKcGeTahBcPGTrCDoxLNuZW.png&amp;size=m" alt="腾讯云 EdgeOne 接入站点" width="100%" height="auto">
</figure>
<h3 style="" id="3.-%E9%80%89%E6%8B%A9%E5%A5%97%E9%A4%90">3. 选择套餐</h3>
<p style="">根据你的流量规模和功能需求选择合适的套餐。个人博客或小型站点可以从个人版开始，按需升级。选择后勾选服务协议，点击<strong>下一步</strong>。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FmoHcBSBUykHXjsObVSLOGASZuYfbiHky.png&amp;size=m" alt="腾讯云 EdgeOne 选择套餐" width="100%">
</figure>
<h3 style="" id="4.-%E9%80%89%E6%8B%A9%E5%8A%A0%E9%80%9F%E5%8C%BA%E5%9F%9F%E5%92%8C%E6%8E%A5%E5%85%A5%E6%A8%A1%E5%BC%8F">4. 选择加速区域和接入模式</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FiWlpOdMIHGLfvyOzmoJWrqfkJXVFIhvz.png&amp;size=m" alt="腾讯云 EdgeOne 选择加速区域" width="100%">
</figure>
<p style=""><strong>加速区域</strong></p>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>加速区域</th>
    <th>说明</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>中国大陆可用区</td>
    <td>仅在中国大陆节点加速，需域名已备案</td>
   </tr>
   <tr>
    <td>全球可用区</td>
    <td>全球节点加速，需域名已备案</td>
   </tr>
   <tr>
    <td>全球可用区（不含中国大陆）</td>
    <td>海外节点加速，不要求域名备案</td>
   </tr>
  </tbody>
 </table>
</div>
<p style="">根据你的访客主要分布地区选择对应的加速区域。</p>
<p style=""><strong>接入模式</strong></p>
<ul>
 <li>
  <p style="">如果你的域名和 DNS 服务都在腾讯云，推荐使用 <strong>NS 接入</strong>：EdgeOne 可以直接读取现有 DNS 记录并一键导入，后续新增域名、开启加速也最为方便；</p>
 </li>
 <li>
  <p style="">如果域名托管在其他服务商（如阿里云、Cloudflare 等），推荐使用 <strong>CNAME 接入</strong>：保留原有 DNS 服务商，只需在每个加速域名下添加一条 CNAME 记录指向 EdgeOne 分配的地址即可。</p>
 </li>
</ul>
<h3 style="" id="5.-%E6%B7%BB%E5%8A%A0%E5%8A%A0%E9%80%9F%E5%9F%9F%E5%90%8D">5. 添加加速域名</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FAmFsxOOmzvzJWonBjuqWZuUcbIUXORZU.png&amp;size=m" alt="腾讯云 EdgeOne 配置回源信息" width="100%">
</figure>
<p style="">站点创建完成后，进入 <strong>域名服务 → 域名管理</strong>，点击<strong>添加域名</strong>，按以下说明填写配置：</p>
<p style=""><strong>域名配置</strong></p>
<ul>
 <li>
  <p style=""><strong>加速域名</strong>：填写子域名部分，例如填写 <code>www</code> 即对应 <code>www.example.com</code></p>
 </li>
</ul>
<p style=""><strong>回源配置</strong></p>
<ul>
 <li>
  <p style=""><strong>源站配置</strong>：选择 <strong>IP/域名</strong>，填写你的服务器公网 IP 地址</p>
 </li>
 <li>
  <p style=""><strong>回源协议</strong>：选择<strong>协议跟随</strong>，EdgeOne 会根据访客请求协议自动选择回源方式</p>
 </li>
 <li>
  <p style=""><strong>回源端口</strong>：Halo 默认为 <code>8090</code>，如果已通过 Nginx 反代到标准端口，HTTP 填 <code>80</code>，HTTPS 填 <code>443</code></p>
 </li>
 <li>
  <p style=""><strong>回源 HOST 头</strong>：选择<strong>使用加速域名</strong></p>
 </li>
</ul>
<p style=""><strong>推荐模版</strong></p>
<p style="">选择<strong>不使用模版</strong>，后续我们会在"针对 Halo 的推荐配置"章节中手动配置各项参数。</p>
<p style="">填写完成后点击<strong>下一步</strong>，EdgeOne 会展示需要在你的 DNS 服务商处添加的 CNAME 记录：</p>
<ul>
 <li>
  <p style=""><strong>主机记录</strong>：你填写的子域名，例如 <code>www</code></p>
 </li>
 <li>
  <p style=""><strong>记录类型</strong>：<code>CNAME</code></p>
 </li>
 <li>
  <p style=""><strong>记录值</strong>：EdgeOne 分配的 CNAME 地址</p>
 </li>
</ul>
<p style="">前往你的域名解析服务商，按照上述信息添加 CNAME 记录后，点击<strong>完成</strong>即可。解析生效后，访客流量将自动经由 EdgeOne 节点加速。</p>
<h3 style="" id="6.-%E9%85%8D%E7%BD%AE-https">6. 配置 HTTPS</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FdMNCmlyltxJeoayJaRwomNAGYntWESGM.png&amp;size=m" alt="腾讯云 EdgeOne 配置 HTTPS" width="100%">
</figure>
<p style="">EdgeOne 支持为加速域名自动申请和部署免费 HTTPS 证书，无需手动操作。</p>
<p style="">进入 <strong>域名服务 → 域名管理</strong>，在域名列表中找到对应域名，点击 <strong>HTTPS 配置</strong> 列下的<strong>配置</strong>按钮：</p>
<ol>
 <li>
  <p style="">配置方式选择<strong>申请免费证书</strong>（推荐），验证方式选择<strong>自动验证</strong>；</p>
 </li>
 <li>
  <p style="">点击<strong>保存</strong>，EdgeOne 会自动申请证书并完成部署，证书到期前会自动续期。</p>
 </li>
</ol>
<p style="">注意：申请证书前需要确保域名的 CNAME 解析已生效，否则验证无法通过。证书申请期间，域名的 HTTPS 访问可能短暂不可用。</p>
<p style="">如果你已有自己的 SSL 证书，可以选择<strong>使用 SSL 托管证书</strong>，上传后绑定即可。</p>
<p style="">证书配置完成后，还需要在 Halo 控制台将<strong>外部访问地址</strong>更新为 <code>https://</code> 开头的地址（路径：<strong>控制台 → 概览 → 外部访问地址</strong>），否则页面中的静态资源链接仍会生成 HTTP 地址，导致混合内容警告。</p>
<p style="">最终，当域名列表中的状态为 <strong>已部署 </strong>时，就可以尝试通过域名访问网站了，如果能正常访问，那么代表配置成功。</p>
<h2 style="" id="%E9%92%88%E5%AF%B9-halo-%E7%9A%84%E6%8E%A8%E8%8D%90%E9%85%8D%E7%BD%AE">针对 Halo 的推荐配置</h2>
<p style="">站点接入完成后，建议在 <strong>加速与安全 → 站点加速</strong> 中按以下说明调整配置，以获得更好的加速效果并确保 Halo 功能正常。</p>
<h3 style="" id="%E8%8A%82%E7%82%B9%E7%BC%93%E5%AD%98-ttl">节点缓存 TTL</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FadBXmyMkMwcLRjxZAVyqmUhxwKQBBXip.png&amp;size=m" alt="腾讯云 EdgeOne 节点缓存 TTL" width="100%">
</figure>
<p style="">设置为<strong>遵循源站 Cache-Control</strong>，Halo 会为各个请求设置合理的 Cache-Control，通常无需自行设置。此外，如果请求没有 Cache-Control 头，推荐设置为不缓存。</p>
<h3 style="" id="%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BC%93%E5%AD%98-ttl">浏览器缓存 TTL</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FEFAIramHSFIurzKRqnUWeWAedjAXHhJt.png&amp;size=m" alt="腾讯云 EdgeOne 浏览器缓存 TTL" width="100%">
</figure>
<p style="">设置为<strong>遵循源站 Cache-Control</strong>。Halo 会为静态资源设置合理的缓存头，EdgeOne 遵循这些设置可以避免缓存策略冲突。</p>
<h3 style="" id="%E6%9F%A5%E8%AF%A2%E5%AD%97%E7%AC%A6%E4%B8%B2">查询字符串</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FMxNrKIszADUASlDfyJHDNtdbAFFtjBnR.png&amp;size=m" alt="腾讯云 EdgeOne 查询字符串配置" width="100%">
</figure>
<p style="">设置为<strong>全部保留</strong>。Halo 的部分请求（如附件下载、API 请求）依赖 URL 中的查询参数，全部保留可以避免因参数被丢弃导致请求异常。</p>
<h3 style="" id="%E5%BC%BA%E5%88%B6-https">强制 HTTPS</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FwlgDawqLAcXYwSCEAwQosTCEKUkpRHKT.png&amp;size=m" alt="腾讯云 EdgeOne 强制 HTTPS" width="100%">
</figure>
<p style="">开启后，所有 HTTP 请求会被自动重定向到 HTTPS。建议在 HTTPS 证书配置完成后开启，重定向方式选择 <strong>302</strong> 即可。</p>
<h3 style="" id="%E5%AE%A2%E6%88%B7%E7%AB%AF-ip-%E5%A4%B4%E9%83%A8">客户端 IP 头部</h3>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FIoroVlWmfvQeRdTJtqOvFRrlYIUDIbVY.png&amp;size=m" alt="腾讯云 EdgeOne 客户端 IP 头部" width="100%">
</figure>
<p style="">开启后，EdgeOne 会将访客的真实 IP 通过请求头传递给源站。头部名称设置为 <strong>X-Real-IP</strong>，这样 Halo 才能正确记录访客的真实 IP 地址，而不是 EdgeOne 节点的 IP。</p>
<h2 style="" id="%E5%9B%BE%E7%89%87%E5%A4%84%E7%90%86%EF%BC%88%E5%8F%AF%E9%80%89%EF%BC%89">图片处理（可选）</h2>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FOTcAzpOHRTfpBQASPGiAwGRcUnBJzlLm.png&amp;size=m" alt="腾讯云 EdgeOne 图片瘦身优化" width="100%">
</figure>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FQaMkqAOhLHoNXGgEerQPmUCVYOuKaOXP.png&amp;size=m" alt="腾讯云 EdgeOne 智能格式压缩" width="100%">
</figure>
<p style="">EdgeOne 提供两个图片优化功能，可在 <strong>多媒体服务 → 图片处理</strong> 中开启：</p>
<ul>
 <li>
  <p style=""><strong>图片瘦身优化</strong>：自动压缩图片体积，默认质量为 75%，几乎不影响视觉效果，可有效提升图片加载速度</p>
 </li>
 <li>
  <p style=""><strong>智能格式压缩</strong>：自动将图片转换为 WebP 或 AVIF 格式，体积更小，浏览器会按支持情况自动适配</p>
 </li>
</ul>
<p style="">这两项功能均为<strong>按量付费</strong>，按图片处理次数计费（0.1 元/千次），图片流量较大的站点建议先评估成本再决定是否开启。详细计费说明可参考<a href="https://cloud.tencent.com/document/product/1552/112016" target="_blank" rel="">媒体处理费用</a>。</p>
<h2 style="" id="%E9%AA%8C%E8%AF%81%E6%98%AF%E5%90%A6%E7%94%9F%E6%95%88">验证是否生效</h2>
<p style="">配置完成后，可以通过以下方式验证 CDN 是否正常工作：</p>
<ol>
 <li>
  <p style="">打开浏览器开发者工具，访问你的站点，在 Network 面板中查看静态资源的响应头；</p>
 </li>
 <li>
  <p style="">如果看到类似 <code>server: TencentEdgeOne</code> 或 <code>eo-cache-status: HIT</code> 的响应头，说明资源已由 EdgeOne 代理；</p>
 </li>
 <li>
  <p style="">也可以使用 <a href="https://dnschecker.org/" target="_blank" rel="nofollow">DNS Checker</a> 验证域名解析是否已指向 EdgeOne 节点。</p>
 </li>
</ol>
<h2 style="" id="%E9%85%8D%E5%90%88%E9%A1%B5%E9%9D%A2%E7%BC%93%E5%AD%98%E6%8F%92%E4%BB%B6">配合页面缓存插件</h2>
<p style="">在大多数情况下，CDN 对于静态资源通常有比较好的效果，但页面请求通常不会进行缓存，如果你期望对 Halo 的页面也在节点缓存，可以考虑配合静态页面缓存插件使用，详见：<a href="https://www.halo.run/archives/page-cache-plugin-optimization">使用页面缓存插件优化 Halo 网站速度</a></p>]]></description><guid isPermaLink="false">/archives/tencent-cloud-edge-one-website-acceleration</guid><dc:creator>Ryan Wang</dc:creator><category>网站优化</category><pubDate>Mon, 13 Apr 2026 15:21:00 GMT</pubDate></item><item><title><![CDATA[Halo 网站加载慢？8 种原因排查与优化方法]]></title><link>https://www.halo.run/archives/website-loading-slow-troubleshooting</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=Halo%20%E7%BD%91%E7%AB%99%E5%8A%A0%E8%BD%BD%E6%85%A2%EF%BC%9F8%20%E7%A7%8D%E5%8E%9F%E5%9B%A0%E6%8E%92%E6%9F%A5%E4%B8%8E%E4%BC%98%E5%8C%96%E6%96%B9%E6%B3%95&amp;url=/archives/website-loading-slow-troubleshooting" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E5%A6%82%E4%BD%95%E5%AE%9A%E4%BD%8D%E9%97%AE%E9%A2%98">如何定位问题</h2>
<p style="">在开始排查之前，建议先打开浏览器的开发者工具（按 F12 或右键 → 检查），切换到 <strong>Network</strong> 标签页，刷新页面后查看各请求的耗时情况。重点关注：</p>
<ul>
 <li>
  <p style="">哪个请求耗时最长？</p>
 </li>
 <li>
  <p style="">是 HTML 文档本身加载慢，还是图片、JS、CSS 等静态资源加载慢？</p>
 </li>
 <li>
  <p style="">是所有资源都慢，还是个别资源特别慢？</p>
 </li>
</ul>
<p style="">根据慢在哪里，再对照下方的可能原因进行针对性排查。</p>
<h2 style="" id="%E5%8F%AF%E8%83%BD%E7%9A%84%E5%8E%9F%E5%9B%A0%E4%B8%8E%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95">可能的原因与解决办法</h2>
<h3 style="" id="%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%B8%A6%E5%AE%BD%E4%B8%8D%E8%B6%B3">服务器带宽不足</h3>
<p style="">这是最常见的原因之一。许多云服务商的入门套餐带宽只有 1Mbps，在这种配置下，一张未经压缩的高清图片就可能占满带宽，导致整个页面加载缓慢。</p>
<p style=""><strong>表现</strong>：页面所有资源加载都慢，Network 面板中请求队列很长。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">升级服务器带宽，一般 3Mbps 以上即可满足日常网站需求；</p>
 </li>
 <li>
  <p style="">如果暂时无法升级，通过 CDN 加速来缓解带宽压力（见下方"使用 CDN 加速"部分）。</p>
 </li>
</ul>
<h3 style="" id="%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%9C%B0%E7%90%86%E4%BD%8D%E7%BD%AE%E8%B7%9D%E7%A6%BB%E8%AE%BF%E5%AE%A2%E5%A4%AA%E8%BF%9C">服务器地理位置距离访客太远</h3>
<p style="">服务器地区与访客所在地越远，网络延迟越高，页面首字节时间（TTFB）越长。</p>
<p style=""><strong>表现</strong>：Network 面板中 HTML 文档的等待时间（Waiting）较长，但下载时间正常。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">更换到离目标访客更近的机房；</p>
 </li>
 <li>
  <p style="">如果访客分布在多个地区，可以考虑使用 CDN 将静态资源分发到各地节点。</p>
 </li>
</ul>
<h3 style="" id="%E5%9B%BE%E7%89%87%E4%BD%93%E7%A7%AF%E8%BF%87%E5%A4%A7">图片体积过大</h3>
<p style="">图片通常是页面体积最大的部分，未经优化的图片会显著拖慢加载速度。</p>
<p style=""><strong>表现</strong>：Network 面板中图片请求耗时长、传输体积大（单张几百 KB 甚至几 MB）。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">上传图片前先进行无损压缩，推荐使用 <a href="https://squoosh.app" target="_blank" rel="nofollow">Squoosh</a> 或 <a href="https://tinypng.com" target="_blank" rel="nofollow">TinyPNG</a>；</p>
 </li>
 <li>
  <p style="">配置 WebP 图片转换服务，WebP 格式相比 JPG/PNG 体积更小、质量相当，可参考 <a href="https://www.halo.run/archives/halo-and-webp" target="_self" rel="">优雅的让 Halo 支持 webp 图片输出</a>；</p>
 </li>
 <li>
  <p style="">尽量避免在文章中直接粘贴未压缩的原始截图。</p>
 </li>
</ul>
<h3 style="" id="%E4%B8%BB%E9%A2%98%E5%BC%95%E7%94%A8%E4%BA%86%E4%B8%8D%E7%A8%B3%E5%AE%9A%E7%9A%84%E7%AC%AC%E4%B8%89%E6%96%B9-cdn">主题引用了不稳定的第三方 CDN</h3>
<p style="">部分主题的 CSS、JS 或字体文件托管在公共 CDN（如 jsDelivr、cdnjs、Google Fonts 等），当这些 CDN 在某些网络环境下访问缓慢或不稳定时，整个页面的渲染会被阻塞。</p>
<p style=""><strong>表现</strong>：Network 面板中某个来自第三方域名的资源（如 <code>fonts.googleapis.com</code>、<code>cdn.jsdelivr.net</code>）长时间挂起。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">将该资源下载到本地，托管在自己的服务器上；</p>
 </li>
 <li>
  <p style="">换用在国内访问更稳定的 CDN 节点；</p>
 </li>
 <li>
  <p style="">如果是字体文件导致的，可以考虑改用系统字体或自托管字体。</p>
 </li>
</ul>
<h3 style="" id="%E6%9C%AA%E5%90%AF%E7%94%A8-nginx-gzip-%E5%8E%8B%E7%BC%A9">未启用 Nginx Gzip 压缩</h3>
<p style="">如果未启用 Gzip 压缩，HTML、CSS、JS 等文本资源会以原始大小传输，增加传输时间。</p>
<p style=""><strong>表现</strong>：Network 面板中文本资源的传输体积与原始大小相近，没有明显的压缩比。</p>
<p style=""><strong>解决办法</strong>：在 Nginx 配置中启用 Gzip：</p>
<pre><code class="language-nginx">gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml;
gzip_min_length 1024;</code></pre>
<h3 style="" id="%E6%9C%AA%E9%85%8D%E7%BD%AE%E6%B5%8F%E8%A7%88%E5%99%A8%E7%BC%93%E5%AD%98">未配置浏览器缓存</h3>
<p style="">静态资源（图片、CSS、JS）如果没有设置合理的缓存头，用户每次访问都需要重新下载，造成不必要的重复请求。</p>
<p style=""><strong>表现</strong>：反复访问同一页面时，Network 面板中静态资源仍然是 200 状态而非 304 或 from cache。</p>
<p style=""><strong>解决办法</strong>：在 Nginx 中为静态资源设置缓存：</p>
<pre><code class="language-nginx">location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff2)$ {
    expires 30d;
    add_header Cache-Control "public, no-transform";
}</code></pre>
<h3 style="" id="%E6%9C%8D%E5%8A%A1%E5%99%A8%E8%B5%84%E6%BA%90%E4%B8%8D%E8%B6%B3%EF%BC%88cpu-%2F-%E5%86%85%E5%AD%98%EF%BC%89">服务器资源不足（CPU / 内存）</h3>
<p style="">当服务器 CPU 或内存使用率长期处于高位时，Halo 的响应速度也会受到影响，尤其是在并发请求较多的情况下。</p>
<p style=""><strong>表现</strong>：TTFB 偏高，服务器日志中出现请求超时或响应慢的记录。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">通过 <code>top</code> 或 <code>htop</code> 查看服务器资源占用情况；</p>
 </li>
 <li>
  <p style="">适当调整 Halo 的 JVM 参数（<code>-Xmx</code> / <code>-Xms</code>），避免内存设置过低或过高；</p>
 </li>
 <li>
  <p style="">如果资源持续紧张，考虑升级服务器配置。</p>
 </li>
</ul>
<h3 style="" id="dns-%E8%A7%A3%E6%9E%90%E9%80%9F%E5%BA%A6%E6%85%A2">DNS 解析速度慢</h3>
<p style="">DNS 解析是浏览器访问网站的第一步，如果 DNS 服务商响应慢，也会影响整体加载体验。</p>
<p style=""><strong>表现</strong>：Network 面板中请求的 DNS Lookup 阶段耗时较长。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">更换响应速度更快的 DNS 服务商（如 DNSPod、阿里云 DNS）；</p>
 </li>
 <li>
  <p style="">启用 DNS 预解析，在页面 <code>&lt;head&gt;</code> 中添加 <code>&lt;link rel="dns-prefetch" href="//your-cdn-domain.com"&gt;</code>。</p>
 </li>
</ul>
<h3 style="" id="%E6%8F%92%E4%BB%B6%E6%88%96%E4%B8%BB%E9%A2%98%E5%BC%95%E5%85%A5%E4%BA%86%E8%BF%87%E5%A4%9A%E7%9A%84-js-%2F-css">插件或主题引入了过多的 JS / CSS</h3>
<p style="">每个启用的插件都可能向页面注入额外的 JS 和 CSS 文件，插件数量越多，页面需要加载的资源也越多。部分插件即使功能用不上，只要处于启用状态就会在前台页面加载相关资源，拖慢整体速度。</p>
<p style=""><strong>表现</strong>：Network 面板中出现大量来自 <code>/plugins/</code> 路径的资源请求，或页面总请求数明显偏多。</p>
<p style=""><strong>解决办法</strong>：</p>
<ul>
 <li>
  <p style="">不需要的插件及时<strong>关闭或卸载</strong>，而不是仅仅停用功能；</p>
 </li>
 <li>
  <p style="">检查已启用的插件是否都在实际使用，按需保留；</p>
 </li>
 <li>
  <p style="">主题自身引入的 JS / CSS 较多时，可以联系主题作者或自行优化，去除不必要的依赖。</p>
 </li>
</ul>
<h2 style="" id="%E4%BD%BF%E7%94%A8-cdn-%E5%8A%A0%E9%80%9F">使用 CDN 加速</h2>
<p style="">如果以上单项优化仍无法满足需求，可以考虑接入全站 CDN 加速。CDN 会将静态资源缓存到各地节点，访客就近获取资源，从根本上解决因服务器地区或带宽不足导致的加载问题。</p>
<p style="">国内常见的 CDN 服务商有阿里云 CDN、腾讯云 CDN、又拍云等，配置时通常需要将域名的 CNAME 指向 CDN 提供的接入地址，具体可参考各服务商的接入文档。</p>
<ul>
 <li>
  <p style=""><a href="https://www.halo.run/archives/tencent-cloud-edge-one-website-acceleration">腾讯云 EdgeOne 接入 Halo 配置指南</a></p>
 </li>
 <li>
  <p style=""><a href="https://www.halo.run/archives/upyun-cdn-website-acceleration">又拍云 CDN 接入 Halo 配置指南</a></p>
 </li>
 <li>
  <p style=""><a href="https://www.halo.run/archives/qiniu-cdn-website-acceleration">七牛云 DCDN 接入 Halo 配置指南</a></p>
 </li>
 <li>
  <p style=""><a href="https://www.halo.run/archives/aliyun-esa-website-acceleration">阿里云 ESA 接入 Halo 配置指南</a></p>
 </li>
</ul>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/website-loading-slow-troubleshooting</guid><dc:creator>Ryan Wang</dc:creator><category>网站优化</category><category>常见问题</category><pubDate>Mon, 13 Apr 2026 09:46:00 GMT</pubDate></item><item><title><![CDATA[Halo 导入 Word 文档教程：批量导入并保留图片]]></title><link>https://www.halo.run/archives/import-word-document</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=Halo%20%E5%AF%BC%E5%85%A5%20Word%20%E6%96%87%E6%A1%A3%E6%95%99%E7%A8%8B%EF%BC%9A%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5%E5%B9%B6%E4%BF%9D%E7%95%99%E5%9B%BE%E7%89%87&amp;url=/archives/import-word-document" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E6%A6%82%E8%A7%88">概览</h2>
<p style="">Halo 支持通过<a href="https://www.halo.run/store/apps/app-SUvBR">内容助手</a>插件将 Word 文档（<code>.doc</code>、<code>.docx</code>）直接导入为文章，导入时会自动提取文档内容并将文档中的图片上传到 Halo 附件，适合从 Word 迁移内容或批量发布已有文档的场景。</p>
<h2 style="" id="%E5%AE%89%E8%A3%85%E5%86%85%E5%AE%B9%E5%8A%A9%E6%89%8B%E6%8F%92%E4%BB%B6">安装内容助手插件</h2>
<p style="">前往应用市场安装<a href="https://www.halo.run/store/apps/app-SUvBR">内容助手</a>插件，安装方式可参考<a href="https://docs.halo.run/user-guide/plugins" target="_blank" rel="" class="ui-citation-link">插件安装文档</a>。</p>
<h2 style="" id="%E5%AF%BC%E5%85%A5-word-%E6%96%87%E6%A1%A3">导入 Word 文档</h2>
<ol>
 <li>
  <p style="">登录 Halo 控制台，进入 <strong>工具 → 文章导入</strong>；</p>
 </li>
 <li>
  <p style="">选择 <strong>Word（.docx） 导入 </strong>选项卡；</p>
 </li>
 <li>
  <p style="">上传一个或多个 Word 文件（支持批量选择）；</p>
 </li>
 <li>
  <p style="">确认后，插件会自动将每个文档转换为一篇文章，文档中引用的图片会同步上传到 Halo 附件并替换为对应的链接。</p>
 </li>
</ol>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FLisqMaHuNwkVkKtwrxIayfzpTBgwTUOK.png&amp;size=m" alt="Halo 内容助手插件导入 Word 文件" width="100%" height="auto">
</figure>
<h2 style="" id="%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9">注意事项</h2>
<ul>
 <li>
  <p style="">导入时会尽量保留 Word 文档的格式，但部分复杂排版（如多栏布局、艺术字等）可能无法完整还原，建议导入后检查一遍内容；</p>
 </li>
 <li>
  <p style="">文档中嵌入的图片会自动上传，但通过链接引用的外部图片不会被处理；</p>
 </li>
 <li>
  <p style="">如果需要导入 Markdown 文件，同样可以在 <strong>工具 → 文章导入</strong> 中切换格式进行操作。</p>
 </li>
</ul>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/import-word-document</guid><dc:creator>Ryan Wang</dc:creator><category>使用技巧</category><pubDate>Mon, 13 Apr 2026 08:33:00 GMT</pubDate></item><item><title><![CDATA[主题开发技巧：为 Halo 网站添加一个知识库样式的页面]]></title><link>https://www.halo.run/archives/create-kb-page-theme</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E4%B8%BB%E9%A2%98%E5%BC%80%E5%8F%91%E6%8A%80%E5%B7%A7%EF%BC%9A%E4%B8%BA%20Halo%20%E7%BD%91%E7%AB%99%E6%B7%BB%E5%8A%A0%E4%B8%80%E4%B8%AA%E7%9F%A5%E8%AF%86%E5%BA%93%E6%A0%B7%E5%BC%8F%E7%9A%84%E9%A1%B5%E9%9D%A2&amp;url=/archives/create-kb-page-theme" width="1" height="1" alt="" style="opacity:0;">
<p style="">随着 Halo 站点内容越来越丰富，许多站长会面临一个问题：博客列表页适合展示时效性内容，但对于产品文档、使用教程、常见问题等结构化知识内容来说，用普通博客列表来组织显得太扁平，用户很难快速找到自己需要的内容。</p>
<p style="">本文介绍如何利用 Halo 的<strong>自定义分类模板</strong>机制，在不依赖任何额外插件的情况下，为主题添加一套完整的知识库页面，包括知识库入口和子分类文章列表。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FsdHCuTiGDpdVHzhmaAAcnNgVicLljYQI.png&amp;size=m" width="100%" height="auto">
</figure>
<h2 style="" id="%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86">实现原理</h2>
<p style="">Halo 支持在 <code>theme.yaml</code> 中为分类（category）注册额外的渲染模板，称为 <strong>自定义分类模板</strong>。用户在后台管理某个分类时，可以从下拉菜单中选择使用哪套模板来渲染该分类页面。</p>
<p style="">知识库的层级结构正好与分类树对应：</p>
<pre><code class="language-plaintext">知识库根分类（使用 category_knowledge_base_root 模板）
├── 入门指南（使用 category_knowledge_base 模板）
│   ├── 文章 A
│   └── 文章 B
└── 进阶使用（使用 category_knowledge_base 模板）
    ├── 文章 C
    └── 文章 D</code></pre>
<h2 style="" id="%E7%AC%AC%E4%B8%80%E6%AD%A5%EF%BC%9A%E5%9C%A8-theme.yaml-%E6%B3%A8%E5%86%8C%E6%A8%A1%E6%9D%BF">第一步：在 theme.yaml 注册模板</h2>
<p style="">在 <code>theme.yaml</code> 的 <code>spec.customTemplates</code> 下注册模板：</p>
<pre><code class="language-yaml">spec:
  customTemplates:
    post:
      - name: 知识库
        description: 知识库文章页
        file: post_knowledge_base.html
    category:
      - name: 知识库入口
        description: 知识库入口页，展示所有子分类及文章预览
        file: category_knowledge_base_root.html
      - name: 知识库
        description: 知识库子分类，展示该分类下的文章列表
        file: category_knowledge_base.html</code></pre>
<p style="">修改完 <code>theme.yaml</code> 后，需要在后台 <strong>主题 → 重载主题配置</strong> 才能生效。之后在分类设置中就能看到这些模板选项。</p>
<h2 style="" id="%E7%AC%AC%E4%BA%8C%E6%AD%A5%EF%BC%9A%E7%9F%A5%E8%AF%86%E5%BA%93%E5%85%A5%E5%8F%A3%E9%A1%B5">第二步：知识库入口页</h2>
<p style="">模板名称：<code>category_knowledge_base_root.html</code></p>
<p style="">入口页负责展示整个知识库的全貌：标题、描述、搜索入口，以及所有子分类的卡片网格。</p>
<h3 style="" id="%E6%A0%B8%E5%BF%83-api">核心 API</h3>
<ul>
 <li>
  <p style=""><code>categoryFinder.getByNames(category.spec.children)</code> — 根据父分类的 <code>children</code> 字段获取子分类列表</p>
 </li>
 <li>
  <p style=""><code>postFinder.listByCategory(1, 5, subCat.metadata.name)</code> — 获取每个子分类的前 5 篇文章</p>
 </li>
</ul>
<pre><code class="language-html">&lt;!-- Hero 区域：展示知识库标题、描述和搜索入口 --&gt;
&lt;section class="hero"&gt;
  &lt;h1 th:text="${category.spec.displayName}"&gt;&lt;/h1&gt;
  &lt;p
    th:text="${category.spec.description ?: '快速查找所需内容，轻松解决每一个问题。'}"
  &gt;&lt;/p&gt;

  &lt;!-- 搜索按钮（需安装 PluginSearchWidget） --&gt;
  &lt;button
    th:if="${pluginFinder.available('PluginSearchWidget')}"
    onclick="javascript: SearchWidget.open();"
    type="button"
  &gt;
    搜索文章...
  &lt;/button&gt;
&lt;/section&gt;

&lt;!-- 子分类宫格 --&gt;
&lt;section class="kb-grid-section"&gt;
  &lt;th:block
    th:with="subCategories = ${categoryFinder.getByNames(category.spec.children)}"
  &gt;
    &lt;div class="kb-grid"&gt;
      &lt;th:block th:each="subCat : ${subCategories}"&gt;
        &lt;div
          th:with="subPosts = ${postFinder.listByCategory(1, 5, subCat.metadata.name)}"
          class="kb-card"
        &gt;
          &lt;!-- 卡片头部：图标 + 名称 + 文章数 --&gt;
          &lt;a th:href="@{${subCat.status.permalink}}" class="kb-card-header"&gt;
            &lt;img
              th:unless="${#strings.isEmpty(subCat.spec.cover)}"
              th:src="${subCat.spec.cover}"
            /&gt;
            &lt;h2 th:text="${subCat.spec.displayName}"&gt;&lt;/h2&gt;
            &lt;span th:text="|${subCat.postCount} 篇文章|"&gt;&lt;/span&gt;
          &lt;/a&gt;
          &lt;!-- 文章预览列表 --&gt;
          &lt;ul class="kb-article-list"&gt;
            &lt;li th:each="post : ${subPosts.items}"&gt;
              &lt;a
                th:href="@{${post.status.permalink}}"
                th:text="${post.spec.title}"
              &gt;&lt;/a&gt;
            &lt;/li&gt;
            &lt;li th:if="${subPosts.total &gt; 5}"&gt;
              &lt;a
                th:href="@{${subCat.status.permalink}}"
                th:text="|查看全部 ${subPosts.total} 篇 →|"
              &gt;&lt;/a&gt;
            &lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
      &lt;/th:block&gt;
    &lt;/div&gt;
  &lt;/th:block&gt;
&lt;/section&gt;</code></pre>
<p style="">有两处值得注意：搜索按钮通过 <code>pluginFinder.available('PluginSearchWidget')</code> 判断是否安装了搜索插件，安装了才渲染，点击后调用 <code>SearchWidget.open()</code> 打开全站搜索弹窗；子分类的图标直接使用了 <code>category.spec.cover</code>，可以在后台为每个子分类上传一张图标图片。</p>
<h2 style="" id="%E7%AC%AC%E4%B8%89%E6%AD%A5%EF%BC%9A%E5%AD%90%E5%88%86%E7%B1%BB%E6%96%87%E7%AB%A0%E5%88%97%E8%A1%A8%E9%A1%B5">第三步：子分类文章列表页</h2>
<p style="">模板名称：<code>category_knowledge_base.html</code></p>
<p style="">该模板使用分类模板的标准变量 <code>category</code>（当前分类信息）和 <code>posts</code>（分页文章列表），展示当前子分类下的所有文章。</p>
<h3 style="" id="%E9%9D%A2%E5%8C%85%E5%B1%91%E5%AF%BC%E8%88%AA">面包屑导航</h3>
<p style="">利用 <code>categoryFinder.getBreadcrumbs(category.metadata.name)</code> 自动生成完整路径，无需手动维护层级关系：</p>
<pre><code class="language-html">&lt;nav
  th:with="breadcrumbs = ${categoryFinder.getBreadcrumbs(category.metadata.name)}"
&gt;
  &lt;ol&gt;
    &lt;li&gt;&lt;a href="/"&gt;首页&lt;/a&gt;&lt;/li&gt;
    &lt;li th:each="bc, stats : ${breadcrumbs}"&gt;
      &lt;a
        th:unless="${stats.last}"
        th:href="@{${bc.status.permalink}}"
        th:text="${bc.spec.displayName}"
      &gt;&lt;/a&gt;
      &lt;span
        th:if="${stats.last}"
        th:text="${bc.spec.displayName}"
        aria-current="page"
      &gt;&lt;/span&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/nav&gt;</code></pre>
<h3 style="" id="%E6%96%87%E7%AB%A0%E5%88%97%E8%A1%A8">文章列表</h3>
<p style="">文章列表不显示封面，只展示标题和发布日期，保持知识库的专注感：</p>
<pre><code class="language-html">&lt;ul class="post-list"&gt;
  &lt;li th:each="post : ${posts.items}"&gt;
    &lt;a th:href="@{${post.status.permalink}}" th:text="${post.spec.title}"&gt;&lt;/a&gt;
    &lt;time th:text="${#dates.format(post.spec.publishTime, 'yyyy-MM-dd')}"&gt;&lt;/time&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;nav th:if="${posts.hasPrevious() || posts.hasNext()}"&gt;
  &lt;a
    th:href="@{${posts.prevUrl}}"
    th:classappend="${!posts.hasPrevious() ? 'disabled' : ''}"
    rel="prev"
    &gt;
    上一页
  &lt;/a&gt;
  &lt;span th:text="|${posts.page} / ${posts.totalPages}|"&gt;&lt;/span&gt;
  &lt;a
    th:href="@{${posts.nextUrl}}"
    th:classappend="${!posts.hasNext() ? 'disabled' : ''}"
    rel="next"
    &gt;
  下一页
  &lt;/a&gt;
&lt;/nav&gt;</code></pre>
<h2 style="" id="%E7%AC%AC%E5%9B%9B%E6%AD%A5%EF%BC%9A%E7%9F%A5%E8%AF%86%E5%BA%93%E6%96%87%E7%AB%A0%E9%A1%B5">第四步：知识库文章页</h2>
<p style="">模板名称：<code>post_knowledge_base.html</code></p>
<p style="">这一步并非必须。如果你希望知识库的文章和其他文章样式不同（比如去掉封面图、简化作者信息、侧边栏只保留目录），可以单独新建一个文章模板 <code>post_knowledge_base.html</code>。</p>
<p style="">文章模板同样可以使用 <code>categoryFinder.getBreadcrumbs</code> 来生成面包屑，只需从文章的第一个分类开始反查路径：</p>
<pre><code class="language-html">&lt;th:block
  th:unless="${#lists.isEmpty(post.categories)}"
  th:with="breadcrumbs = ${categoryFinder.getBreadcrumbs(post.categories[0].metadata.name)}"
&gt;
  &lt;!-- 面包屑结构同上 --&gt;
&lt;/th:block&gt;</code></pre>
<h2 style="" id="%E5%9C%A8-halo-%E5%90%8E%E5%8F%B0%E9%85%8D%E7%BD%AE">在 Halo 后台配置</h2>
<p style="">完成模板开发后，在 Halo 后台按以下步骤配置：</p>
<p style=""><strong>新建知识库根分类</strong>：自定义模板选择「知识库入口」，如果你为知识库的文章单独新建了文章模板，还可以在此处设置自定义文章模板为「知识库」。另外建议勾选<strong>在列表中隐藏</strong>，勾选之后该分类下的文章将不会出现在博客归档、首页文章列表等公共列表中，相当于把知识库内容从博客流中独立出来。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FlkcKyCrggSTfCwKejsXFcQEIlBFNKeFg.png&amp;size=m" alt="Halo 编辑文章分类，选择自定义模板" width="100%">
</figure>
<p style=""><strong>新建子分类</strong>：在根分类下新建若干子分类（如「入门指南」「常见问题」），自定义模板选择「知识库」。日后发布文章时只需勾选对应子分类即可自动归入知识库体系。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FuuayMUrYjkohFpsXKhJRCAdxSqAXYovE.png&amp;size=m" alt="Halo 编辑文章分类，选择自定义模板" width="100%">
</figure>
<h2 style="" id="%E6%80%BB%E7%BB%93">总结</h2>
<p style="">整套知识库功能完全基于 Halo 现有机制实现，无需额外插件：</p>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>功能</th>
    <th>机制</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>多套页面样式</td>
    <td><code>theme.yaml</code> 自定义分类模板</td>
   </tr>
   <tr>
    <td>子分类列表</td>
    <td><code>categoryFinder.getByNames(category.spec.children)</code></td>
   </tr>
   <tr>
    <td>文章预览列表</td>
    <td><code>postFinder.listByCategory(page,size,name)</code></td>
   </tr>
   <tr>
    <td>面包屑导航</td>
    <td><code>categoryFinder.getBreadcrumbs(name)</code></td>
   </tr>
   <tr>
    <td>搜索入口</td>
    <td><code>pluginFinder.available()</code> + <code>SearchWidget.open()</code></td>
   </tr>
   <tr>
    <td>内容隔离</td>
    <td>分类「在列表中隐藏」选项</td>
   </tr>
  </tbody>
 </table>
</div>
<p style="">这种「模板即功能」的思路在 Halo 主题开发中非常实用，同样可以用来做产品发布页、案例展示页等差异化内容区域。</p>]]></description><guid isPermaLink="false">/archives/create-kb-page-theme</guid><dc:creator>Ryan Wang</dc:creator><category>开发</category><pubDate>Mon, 13 Apr 2026 07:28:53 GMT</pubDate></item><item><title><![CDATA[Rybbit 接入 Halo 教程：开源隐私友好的流量分析工具]]></title><link>https://www.halo.run/archives/rybbit-website-analytics</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=Rybbit%20%E6%8E%A5%E5%85%A5%20Halo%20%E6%95%99%E7%A8%8B%EF%BC%9A%E5%BC%80%E6%BA%90%E9%9A%90%E7%A7%81%E5%8F%8B%E5%A5%BD%E7%9A%84%E6%B5%81%E9%87%8F%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7&amp;url=/archives/rybbit-website-analytics" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%BB%80%E4%B9%88%E6%98%AF-rybbit%EF%BC%9F">什么是 Rybbit？</h2>
<p style=""><a href="https://rybbit.com/" target="_blank" rel="nofollow">Rybbit</a> 是一款开源的现代化网站分析工具，定位为 Google Analytics 的隐私友好替代方案。除了基础的页面浏览量、访客数、来源渠道等统计之外，Rybbit 还提供了会话回放、漏斗分析、用户旅程、留存分析、错误追踪等进阶功能，数据展示更加直观，适合对流量分析有较高要求的站点。</p>
<p style="">相比 Google Analytics，Rybbit 有以下几个优势：</p>
<ul>
 <li>
  <p style=""><strong>隐私友好</strong>：不使用 Cookie，不收集个人身份信息，符合 GDPR 等隐私法规</p>
 </li>
 <li>
  <p style=""><strong>开源可自托管</strong>：数据完全掌握在自己手中</p>
 </li>
 <li>
  <p style=""><strong>功能丰富</strong>：会话回放、漏斗、用户旅程、留存分析等进阶功能开箱即用</p>
 </li>
 <li>
  <p style=""><strong>实时仪表盘</strong>：实时查看当前在线访客和页面浏览情况</p>
 </li>
 <li>
  <p style=""><strong>界面现代</strong>：交互体验比 GA4 更加直观</p>
 </li>
</ul>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FceLQYEYvrJdWAUZvCnqptMimJkEbHsLB.png&amp;size=m" alt="Rybbit 预览" width="100%" height="auto">
</figure>
<p style=""><a href="https://demo.rybbit.com/81/main" target="_blank" rel="nofollow">查看在线演示</a></p>
<h2 style="" id="%E9%83%A8%E7%BD%B2-rybbit">部署 Rybbit</h2>
<h3 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E4%BD%BF%E7%94%A8-rybbit-cloud">方式一：使用 Rybbit Cloud</h3>
<p style="">如果不想自行维护服务器，可以直接使用 <a href="https://rybbit.com/zh/pricing" target="_blank" rel="nofollow">Rybbit Cloud</a>。Rybbit Cloud 提供 7 天免费试用，之后需要按需订阅，可以根据实际的月页面浏览量和功能需求选择合适的套餐。</p>
<p style="">注册账号后即可直接使用，无需任何部署操作。</p>
<h3 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E8%87%AA%E6%89%98%E7%AE%A1">方式二：自托管</h3>
<h4 style="" id="%E4%BD%BF%E7%94%A8%E4%B8%80%E9%94%AE%E5%AE%89%E8%A3%85%E8%84%9A%E6%9C%AC%EF%BC%88%E6%8E%A8%E8%8D%90%E6%96%B0%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%89">使用一键安装脚本（推荐新服务器）</h4>
<p style="">如果你打算为 Rybbit 单独准备一台服务器，推荐使用官方提供的一键安装脚本。该脚本会自动配置好 Docker 容器、Caddy 反向代理和 HTTPS 证书，无需手动操作。</p>
<p style=""><strong>前提条件</strong></p>
<ul>
 <li>
  <p style="">一台至少 2GB 内存的服务器（推荐 Ubuntu 24 LTS）</p>
 </li>
 <li>
  <p style="">一个已解析到该服务器 IP 的域名或子域名（HTTPS 是必须的，否则浏览器会拦截追踪脚本）</p>
 </li>
</ul>
<p style=""><strong>安装步骤</strong></p>
<ol>
 <li>
  <p style="">安装 Docker Engine，参考 <a href="https://docs.docker.com/engine/install/" target="_blank" rel="nofollow">Docker 官方文档</a></p>
 </li>
 <li>
  <p style="">克隆 Rybbit 仓库</p>
  <pre><code class="language-bash"> git clone https://github.com/rybbit-io/rybbit.git
 cd rybbit</code></pre>
 </li>
 <li>
  <p style="">赋予脚本执行权限</p>
  <pre><code class="language-bash"> chmod +x *.sh</code></pre>
 </li>
 <li>
  <p style="">运行安装脚本，将 <code>your.domain.name</code> 替换为你的域名</p>
  <pre><code class="language-bash"> ./setup.sh your.domain.name</code></pre>
  <p style="">脚本会自动生成配置、启动容器，并由 Caddy 自动申请 SSL 证书，首次运行需要几分钟时间。</p>
 </li>
 <li>
  <p style="">等待 DNS 解析生效后，访问 <code>https://your.domain.name/signup</code> 创建管理员账号即可开始使用。</p>
 </li>
</ol>
<h4 style="" id="%E4%BD%BF%E7%94%A8%E5%B7%B2%E6%9C%89%E7%9A%84%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E6%9C%8D%E5%8A%A1%E5%99%A8">使用已有的反向代理服务器</h4>
<p style="">如果你的服务器上已经运行了 Nginx 等反向代理，可以在启动 Rybbit 时跳过内置的 Caddy，自行配置反向代理。</p>
<p style=""><strong>启动 Rybbit（禁用内置 Web 服务器）</strong></p>
<pre><code class="language-bash">./setup.sh your.domain.name --no-webserver</code></pre>
<p style="">此命令会暴露两个端口：</p>
<ul>
 <li>
  <p style=""><code>3001</code>：后端 API 服务</p>
 </li>
 <li>
  <p style=""><code>3002</code>：前端客户端</p>
 </li>
</ul>
<p style=""><strong>Nginx 配置示例</strong></p>
<pre><code class="language-nginx">server {
    listen 80;
    server_name your.domain.name;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name your.domain.name;

    ssl_certificate /etc/letsencrypt/live/your.domain.name/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your.domain.name/privkey.pem;

    location /api/ {
        proxy_pass http://localhost:3001;
        proxy_set_header HOST $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location / {
        proxy_pass http://localhost:3002;
        proxy_set_header HOST $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}</code></pre>
<h2 style="" id="%E5%9C%A8-rybbit-%E4%B8%AD%E5%88%9B%E5%BB%BA%E7%9B%91%E6%8E%A7%E7%BD%91%E7%AB%99">在 Rybbit 中创建监控网站</h2>
<p style="">登录 Rybbit 控制台，首次访问会先注册，然后提示新增一个网站和组织：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FqVSXhNinpyhXjXVgqycwdlfLRbwWhHjG.png&amp;size=m" alt="Rybbit 初始化" width="100%" height="auto">
</figure>
<p style="">创建完成之后，页面会提供一段类似于下面形式的代码：</p>
<pre><code class="language-vue-html">&lt;script
    src="https://&lt;your-domain&gt;/api/script.js"
    data-site-id="078bd4c1f97d"
    defer
&gt;&lt;/script&gt;</code></pre>
<p style="">复制这段代码，接下来将其配置到 Halo 中。</p>
<h2 style="" id="%E5%9C%A8-halo-%E4%B8%AD%E9%85%8D%E7%BD%AE%E8%BF%BD%E8%B8%AA%E4%BB%A3%E7%A0%81">在 Halo 中配置追踪代码</h2>
<p style="">登录 Halo 控制台，进入 <strong>设置 → 代码注入，</strong>将复制的追踪代码粘贴到 <strong>页脚代码</strong> 输入框中：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FHaCgIunAMwdmedAJkcdwDgBLwMWSyZuX.png&amp;size=m" alt="Halo 配置 Rybbit 跟踪代码" width="100%">
</figure>
<p style="">保存后，访问你的站点任意页面，回到 Rybbit 控制台即可看到实时数据。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FwiUqwyqFhErGYfFnDIZjmsYdfiAmAtgs.png&amp;size=m" alt="Rybbit 预览" width="100%">
</figure>
<h2 style="" id="%E5%8F%82%E8%80%83%EF%BC%9A">参考：</h2>
<ol>
 <li>
  <p style=""><a href="https://rybbit.com/zh/docs/self-hosting-guides/custom-nginx" target="_blank" rel="nofollow">https://rybbit.com/zh/docs/self-hosting</a></p>
 </li>
 <li>
  <p style=""><a href="https://rybbit.com/zh/docs/self-hosting-guides/custom-nginx" target="_blank" rel="nofollow">https://rybbit.com/zh/docs/self-hosting-guides/custom-nginx</a></p>
 </li>
</ol>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/rybbit-website-analytics</guid><dc:creator>Ryan Wang</dc:creator><category>集成</category><pubDate>Sun, 12 Apr 2026 14:16:00 GMT</pubDate></item><item><title><![CDATA[Umami 接入 Halo 教程：自托管网站流量统计]]></title><link>https://www.halo.run/archives/umami-website-analytics</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=Umami%20%E6%8E%A5%E5%85%A5%20Halo%20%E6%95%99%E7%A8%8B%EF%BC%9A%E8%87%AA%E6%89%98%E7%AE%A1%E7%BD%91%E7%AB%99%E6%B5%81%E9%87%8F%E7%BB%9F%E8%AE%A1&amp;url=/archives/umami-website-analytics" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%BB%80%E4%B9%88%E6%98%AF-umami%EF%BC%9F">什么是 Umami？</h2>
<p style=""><a href="https://umami.is" target="_blank" rel="">Umami</a> 是一款开源的网站访问统计工具，可以收集页面浏览量、访客数、来源渠道、设备信息、地理位置等数据，帮助你了解站点的真实流量情况。</p>
<p style="">相比 Google Analytics，Umami 有以下几个优势：</p>
<ul>
 <li>
  <p style=""><strong>隐私友好</strong>：不使用 Cookie，不收集个人身份信息，符合 GDPR 等隐私法规</p>
 </li>
 <li>
  <p style=""><strong>轻量</strong>：追踪脚本体积极小，对页面加载速度几乎没有影响</p>
 </li>
 <li>
  <p style=""><strong>开源可自托管</strong>：数据完全掌握在自己手中，不依赖第三方服务</p>
 </li>
 <li>
  <p style=""><strong>界面简洁</strong>：数据展示直观，核心指标一目了然</p>
 </li>
</ul>
<h2 style="" id="%E9%83%A8%E7%BD%B2-umami">部署 Umami</h2>
<h3 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E4%BD%BF%E7%94%A8-umami-cloud">方式一：使用 Umami Cloud</h3>
<p style="">如果不想自行维护服务器，可以直接使用 <a href="https://umami.is/pricing" target="_blank" rel="">Umami Cloud</a>。Umami Cloud 提供免费套餐，支持最多 3 个网站和每月 10 万次页面浏览，对于个人博客或小型站点通常已经足够。</p>
<p style="">注册账号后即可直接使用，无需任何部署操作。</p>
<h3 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E4%BD%BF%E7%94%A8-docker-compose-%E8%87%AA%E6%89%98%E7%AE%A1">方式二：使用 Docker Compose 自托管</h3>
<p style="">如果希望将数据托管在自己的服务器上，可以使用 Docker Compose 部署 Umami。</p>
<p style=""><strong>前提条件</strong>：服务器已安装 Docker 和 Docker Compose。</p>
<ol>
 <li>
  <p style="">创建工作目录</p>
  <pre><code class="language-bash"> mkdir ~/umami &amp;&amp; cd ~/umami</code></pre>
 </li>
 <li>
  <p style="">创建 <code>docker-compose.yaml</code></p>
  <pre><code class="language-yaml"># 来源于 https://github.com/umami-software/umami/blob/master/docker-compose.yml
services:
  umami:
    image: ghcr.io/umami-software/umami:latest
    ports:
      - "3000:3000"
    environment:
      DATABASE_URL: postgresql://umami:umami@db:5432/umami
      APP_SECRET: replace-me-with-a-random-string
    depends_on:
      db:
        condition: service_healthy
    init: true
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "curl http://localhost:3000/api/heartbeat"]
      interval: 5s
      timeout: 5s
      retries: 5
  db:
    image: postgres:15-alpine
    environment:
      POSTGRES_DB: umami
      POSTGRES_USER: umami
      POSTGRES_PASSWORD: umami
    volumes:
      - umami-db-data:/var/lib/postgresql/data
    restart: always
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 5s
      retries: 5
volumes:
  umami-db-data:</code></pre>
  <p style=""><strong>注意</strong>：请将 <code>APP_SECRET</code> 替换为一个随机字符串，可以使用 <code>openssl rand -hex 32</code> 生成。</p>
 </li>
 <li>
  <p style="">启动服务</p>
  <pre><code class="language-bash"> docker compose up -d</code></pre>
  <p style="">启动后，Umami 默认运行在 <code>http://服务器IP:3000</code>。默认登录账号为 <code>admin</code>，密码为 <code>umami</code>，<strong>请登录后立即修改密码</strong>。</p>
 </li>
 <li>
  <p style="">配置 Nginx 反向代理</p>
  <p style="">如果需要通过域名访问，可以配置 Nginx 反向代理：</p>
  <p style="">配置好域名解析和 HTTPS 证书后，即可通过域名访问 Umami 控制台。</p>
 </li>
</ol>
<h3 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%89%EF%BC%9A%E9%80%9A%E8%BF%87-1panel-%E5%AE%89%E8%A3%85">方式三：通过 1Panel 安装</h3>
<p style="">如果你的服务器使用了 <a href="https://1panel.cn">1Panel</a> 面板，可以在 <strong>应用商店</strong> 中搜索 <strong>Umami</strong> 并按照引导一键安装，无需手动编写配置文件，1Panel 会自动完成数据库和容器的初始化。</p>
<h2 style="" id="%E5%9C%A8-umami-%E4%B8%AD%E5%88%9B%E5%BB%BA%E7%9B%91%E6%8E%A7%E7%BD%91%E7%AB%99">在 Umami 中创建监控网站</h2>
<p style="">登录 Umami 控制台，进入 <strong>设置 → 网站</strong>，点击 <strong>添加网站</strong>：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FVGxjyuGGTSFMduljLojCphBamJPnjzSZ.png&amp;size=m" alt="Umami 添加网站" width="2942px">
</figure>
<p style="">填写网站名称和域名，保存后点击页面右上角的 <strong>编辑 </strong>按钮，进入编辑页面之后可以看到一段 <strong>跟踪代码</strong>，复制这段代码，接下来将其配置到 Halo 中。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FEEoNGBUbCvLyQtVytmzPpwaAiLwKKayF.png&amp;size=m" alt="Umami 查看跟踪代码" width="2942px">
</figure>
<h2 style="" id="%E5%9C%A8-halo-%E4%B8%AD%E9%85%8D%E7%BD%AE%E8%BF%BD%E8%B8%AA%E4%BB%A3%E7%A0%81">在 Halo 中配置追踪代码</h2>
<p style="">登录 Halo 控制台，进入 <strong>设置 → 代码注入</strong>，将复制的追踪代码粘贴到 <strong>全局 head 标签</strong> 输入框中：</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FukDHznPnyjvMiCaGKjbhyfNHWPbZlxqs.png&amp;size=m" alt="Halo 配置 Umami 跟踪链接" width="100%" height="auto">
</figure>
<p style="">保存后，访问你的站点任意页面，回到 Umami 控制台即可看到实时数据。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FjeDipexodwocYSNjWpJazFrXHuoTFRGR.png&amp;size=m" alt="Umami 概览" width="100%" height="auto">
</figure>
<p style="">配置完成后，Umami 会开始记录你的站点访问数据，包括页面浏览量、访客数、访问来源、设备类型等，你可以在 Umami 控制台的仪表盘中查看完整的统计报告。</p>]]></description><guid isPermaLink="false">/archives/umami-website-analytics</guid><dc:creator>Ryan Wang</dc:creator><category>集成</category><pubDate>Sun, 12 Apr 2026 13:20:00 GMT</pubDate></item><item><title><![CDATA[在 Halo 中使用 Markdown 写作的 6 种方式]]></title><link>https://www.halo.run/archives/import-markdown-document</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%9C%A8%20Halo%20%E4%B8%AD%E4%BD%BF%E7%94%A8%20Markdown%20%E5%86%99%E4%BD%9C%E7%9A%84%206%20%E7%A7%8D%E6%96%B9%E5%BC%8F&amp;url=/archives/import-markdown-document" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E6%A6%82%E8%A7%88">概览</h2>
<p style="">Halo 默认使用富文本编辑器，但提供了多种途径让你以 Markdown 的方式撰写和发布内容。无论你是偶尔需要插入一段 Markdown 片段，还是希望将整个写作流程留在本地编辑器中，都可以找到合适的方案。</p>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%80%EF%BC%9A%E5%AE%89%E8%A3%85-markdown-%E7%BC%96%E8%BE%91%E5%99%A8%E6%8F%92%E4%BB%B6">方式一：安装 Markdown 编辑器插件</h2>
<p style="">应用市场提供了多款 Markdown 编辑器插件，安装后可以在控制台直接使用 Markdown 编辑器撰写和发布文章，体验与本地 Markdown 编辑器类似。</p>
<p style="">前往应用市场浏览所有 Markdown 相关插件：<a href="https://www.halo.run/store/apps?tag=markdown&amp;type=PLUGIN">应用市场 - Markdown 插件</a></p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FzNIiCEVfDYLNCMzKrUMJqfKIYcNGRlJc.png&amp;size=m" alt="Halo 应用市场的 Markdown 标签" width="100%" height="auto">
</figure>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%8C%EF%BC%9A%E5%9C%A8%E9%BB%98%E8%AE%A4%E7%BC%96%E8%BE%91%E5%99%A8%E4%B8%AD%E6%8F%92%E5%85%A5-markdown-%E5%9D%97">方式二：在默认编辑器中插入 Markdown 块</h2>
<p style="">如果你大部分时候使用富文本编辑器，只是偶尔需要用 Markdown 语法写某一段内容，可以安装 <strong>Markdown / HTML 内容块</strong>插件。</p>
<p style="">安装后，在默认编辑器中可以插入一个独立的 Markdown 块，该块内支持完整的 Markdown 语法，与富文本内容混排。适合以下场景：</p>
<ul>
 <li>
  <p style="">在富文本文章中插入代码示例或技术说明</p>
 </li>
 <li>
  <p style="">临时使用 Markdown 语法，无需切换整个编辑器</p>
 </li>
 <li>
  <p style="">保留部分已有富文本内容，同时用 Markdown 补充新段落</p>
 </li>
</ul>
<p style="">在应用市场搜索 <strong>Markdown 内容块</strong> 即可安装。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FNwBwoRQNyMwrmLAuuuXVdzvKQNANZmNS.png&amp;size=m" alt="Halo  HTML / Markdown 块插件" width="100%" height="auto">
</figure>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%B8%89%EF%BC%9A%E9%80%9A%E8%BF%87%E5%86%85%E5%AE%B9%E5%8A%A9%E6%89%8B%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5-markdown-%E6%96%87%E4%BB%B6">方式三：通过内容助手批量导入 Markdown 文件</h2>
<p style=""><a href="https://www.halo.run/store/apps/app-SUvBR">内容助手</a>插件支持将本地的 Markdown 文件（包括 <code>.md</code> 文件关联的图片资源）批量导入到 Halo，适合从其他平台迁移内容，或者有大量本地 Markdown 文章需要一次性上传的场景。</p>
<p style=""><strong>使用方式</strong></p>
<ol>
 <li>
  <p style="">在应用市场安装内容助手插件；</p>
 </li>
 <li>
  <p style="">进入 <strong>控制台 → 工具</strong>，找到文章导入功能；</p>
 </li>
 <li>
  <p style="">上传本地的 Markdown 文件，插件会自动处理文件中引用的图片资源。</p>
 </li>
</ol>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FGWsDctHbGPCVGyMQAcIjvSqmpXjXqyyr.png&amp;size=m" alt="Halo 内容助手导入 Markdown 文件" width="100%" height="auto">
</figure>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E5%9B%9B%EF%BC%9Avscode-%E6%8F%92%E4%BB%B6">方式四：VSCode 插件</h2>
<p style=""><a href="https://github.com/halo-sigs/vscode-extension-halo" target="_blank" rel="">vscode-extension-halo</a> 是 Halo 官方维护的 VSCode 扩展，让你可以直接在 VSCode 中将 Markdown 文件发布到 Halo，无需打开浏览器。</p>
<p style=""><strong>主要功能</strong></p>
<ul>
 <li>
  <p style="">将当前 Markdown 文件一键发布到 Halo</p>
 </li>
 <li>
  <p style="">自动将文件中引用的本地图片上传到 Halo 附件</p>
 </li>
 <li>
  <p style="">支持从 Halo 将文章拉取到本地进行编辑</p>
 </li>
 <li>
  <p style="">支持设置文章的分类和标签</p>
 </li>
</ul>
<p style=""><strong>安装方式</strong></p>
<p style="">在 VSCode 扩展市场搜索 <strong>Halo</strong> 并安装，然后通过命令面板执行 <code>Halo Setup</code> 配置站点信息即可。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FvWdPdILgYuKRCpBdzqpvSzTmFKnwIAUt.png&amp;size=m" alt="Halo VSCode 插件发布文章" width="100%" height="auto">
</figure>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E4%BA%94%EF%BC%9Aobsidian-%E6%8F%92%E4%BB%B6">方式五：Obsidian 插件</h2>
<p style=""><a href="https://github.com/halo-sigs/obsidian-halo" target="_blank" rel="">obsidian-halo</a> 是 Halo 官方维护的 Obsidian 社区插件，适合将 Obsidian 作为主要写作工具的用户，可以直接将笔记发布到 Halo，不打断本地写作流。</p>
<p style=""><strong>主要功能</strong></p>
<ul>
 <li>
  <p style="">将当前笔记发布到 Halo</p>
 </li>
 <li>
  <p style="">支持配置多个 Halo 站点，并设置默认站点</p>
 </li>
 <li>
  <p style="">支持从 Halo 将文章同步回 Obsidian</p>
 </li>
 <li>
  <p style="">通过命令面板操作，无需离开 Obsidian</p>
 </li>
</ul>
<p style=""><strong>安装方式</strong></p>
<p style="">在 Obsidian 社区插件中搜索 <strong>Halo</strong> 并安装，然后在插件设置中填写站点地址和 Personal Access Token 即可。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FFBONVtZvPBJKzXRKZhNHmIjoXveMcRCA.png&amp;size=m" alt="Halo Obisidion 插件发布文章" width="100%" height="auto">
</figure>
<h2 style="" id="%E6%96%B9%E5%BC%8F%E5%85%AD%EF%BC%9Ahalo-cli">方式六：Halo CLI</h2>
<p style=""><a href="https://github.com/halo-dev/cli" target="_blank" rel="">Halo CLI</a> 是 Halo 官方提供的命令行工具，支持通过 <code>halo post import-markdown</code> 命令将本地 Markdown 文件导入到 Halo，适合有自动化需求或习惯在终端工作的用户。</p>
<p style=""><strong>安装</strong></p>
<pre><code class="language-bash">npm install -g @halo-dev/cli</code></pre>
<p style=""><strong>登录</strong></p>
<pre><code class="language-bash">halo auth login \
  --profile default \
  --url https://your-halo-site.com \
  --auth-type bearer \
  --token &lt;your-token&gt;</code></pre>
<p style=""><strong>导入 Markdown 文件</strong></p>
<pre><code class="language-bash">halo post import-markdown ./article.md</code></pre>
<p style="">CLI 还支持文章列表查看、草稿管理、插件和主题操作等功能，可通过 <code>halo --help</code> 查看完整命令列表。</p>
<figure style="align-items: start; display: flex; flex-direction: column" data-content-type="image">
 <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=%2Fupload%2Fposts%2FvfBauYJHyggpjGQFWJtZYGgiXGXNAois.png&amp;size=m" alt="Halo 通过 CLI 发布文章" width="1864px">
</figure>
<h2 style="" id="%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9">如何选择</h2>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>方式</th>
    <th>适合场景</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>Markdown 编辑器插件</td>
    <td>希望在控制台直接用 Markdown 写作</td>
   </tr>
   <tr>
    <td>Markdown 内容块</td>
    <td>偶尔在富文本文章中插入 Markdown 片段</td>
   </tr>
   <tr>
    <td>内容助手批量导入</td>
    <td>一次性迁移大量本地 Markdown 文件</td>
   </tr>
   <tr>
    <td>VSCode 插件</td>
    <td>习惯在 VSCode 中写作，需要发布到 Halo</td>
   </tr>
   <tr>
    <td>Obsidian 插件</td>
    <td>以 Obsidian 为主要知识管理和写作工具</td>
   </tr>
   <tr>
    <td>Halo CLI</td>
    <td>需要自动化脚本或命令行批量操作</td>
   </tr>
  </tbody>
 </table>
</div>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/import-markdown-document</guid><dc:creator>Ryan Wang</dc:creator><category>使用技巧</category><pubDate>Sun, 12 Apr 2026 12:42:00 GMT</pubDate></item><item><title><![CDATA[如何从社区版切换到 Halo 付费版]]></title><link>https://www.halo.run/archives/switch-to-halo-pro-and-ecommerce-edition</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=%E5%A6%82%E4%BD%95%E4%BB%8E%E7%A4%BE%E5%8C%BA%E7%89%88%E5%88%87%E6%8D%A2%E5%88%B0%20Halo%20%E4%BB%98%E8%B4%B9%E7%89%88&amp;url=/archives/switch-to-halo-pro-and-ecommerce-edition" width="1" height="1" alt="" style="opacity:0;">
<h2 style="" id="%E4%B8%BA%E4%BB%80%E4%B9%88%E8%80%83%E8%99%91%E5%8D%87%E7%BA%A7%E5%88%B0%E4%BB%98%E8%B4%B9%E7%89%88%EF%BC%9F">为什么考虑升级到付费版？</h2>
<p style="">相比社区版，付费版在内容管理的基础上提供了一系列进阶能力：</p>
<ul>
 <li>
  <p style=""><strong>全站私有化</strong>：整个站点需登录才能访问，适合企业内部知识库、付费社区或不对外公开的内容站点</p>
 </li>
 <li>
  <p style=""><strong>AI 插件</strong>：AI 辅助生成文章、RAG 智能问答，让访客可以直接与你的站点内容对话</p>
 </li>
 <li>
  <p style=""><strong>付费阅读插件</strong>：对部分内容设置付费门槛，支持将内容变现</p>
 </li>
 <li>
  <p style=""><strong>SEO 优化插件</strong>：更完整的搜索引擎优化工具，提升站点在搜索结果中的排名</p>
 </li>
 <li>
  <p style=""><strong>手机号注册登录</strong>：支持短信验证码登录，降低用户注册门槛，提升账号安全性</p>
 </li>
 <li>
  <p style=""><strong>品牌信息自定义</strong>：替换控制台中的 Halo 默认 Logo 及品牌标识，适合对外交付或多品牌运营场景</p>
 </li>
 <li>
  <p style=""><strong>在线商城</strong>（商城版）：品牌官网 + CMS + 线上店铺一体化，支持微信支付、支付宝、Stripe</p>
 </li>
</ul>
<p style="">如果你对版本功能还有疑问，可以先查阅<a href="https://www.halo.run/archives/halo-editions-comparison" target="_self" rel="" class="ui-citation-link">版本区别说明</a>，或访问<a href="https://www.lxware.cn/halo?code=mcYhwMkn" target="_blank" rel="">官方版本对比页面</a>。</p>
<h2 style="" id="%E6%A6%82%E8%A7%88">概览</h2>
<p style="">确认要升级后，切换过程本身非常简单——<strong>你的所有数据、配置和数据库连接信息均无需改动</strong>，只需将运行的镜像或 JAR 包替换为付费版对应的版本并重启，随后按需激活许可证即可。</p>
<p style="">这与 GitLab CE/EE 的升级方式类似：底层数据完全兼容，切换本身只是替换运行文件。</p>
<p style=""><strong>切换前建议先备份数据</strong>，可参考<a href="https://docs.halo.run/user-guide/backup" target="_blank" rel="" class="ui-citation-link">备份与恢复</a>。</p>
<h2 style="" id="docker-compose-%E9%83%A8%E7%BD%B2">Docker Compose 部署</h2>
<p style="">只需将 <code>docker-compose.yaml</code> 中的镜像从社区版改为付费版镜像，其余配置保持不变。</p>
<p style=""><strong>修改镜像地址</strong></p>
<pre><code class="language-yaml">services:
  halo:
    image: registry.fit2cloud.com/halo/halo:2.23 # [!code --]
    image: registry.fit2cloud.com/halo/halo-pro:2.23  # 改为此镜像 [!code ++]</code></pre>
<p style="">镜像对应关系如下：</p>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>版本</th>
    <th>Docker Hub</th>
    <th>国内镜像库</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>社区版</td>
    <td><code>halohub/halo:&lt;version&gt;</code></td>
    <td><code>registry.fit2cloud.com/halo/halo</code></td>
   </tr>
   <tr>
    <td>付费版</td>
    <td><code>halohub/halo-pro:&lt;version&gt;</code></td>
    <td><code>registry.fit2cloud.com/halo/halo-pro</code></td>
   </tr>
  </tbody>
 </table>
</div>
<p style="">将镜像地址替换为付费版对应地址，版本号保持一致即可。如果服务器拉取 Docker Hub 速度缓慢，可以使用国内镜像库地址。</p>
<p style=""><strong>重启服务</strong></p>
<pre><code class="language-bash">docker compose pull
docker compose up -d</code></pre>
<h2 style="" id="docker-%E9%83%A8%E7%BD%B2">Docker 部署</h2>
<p style="">停止并删除原有容器，用付费版镜像重新创建，挂载目录和端口映射保持不变。</p>
<p style=""><strong>停止并删除旧容器</strong></p>
<pre><code class="language-bash">docker stop halo
docker rm halo</code></pre>
<p style=""><strong>拉取付费版镜像</strong></p>
<pre><code class="language-bash"># Docker Hub
docker pull halohub/halo-pro:2.23

# 国内镜像库（拉取缓慢时使用）
docker pull registry.fit2cloud.com/halo/halo-pro:2.23</code></pre>
<p style=""><strong>重新创建容器</strong></p>
<p style="">将原启动命令中的镜像地址替换为付费版镜像，其他参数完全不变。以下以常见配置为例：</p>
<pre><code class="language-bash">docker run -it -d \
  --name halo \
  -p 8090:8090 \
  -v ~/.halo2:/root/.halo2 \
  -e JVM_OPTS="-Xmx256m -Xms256m" \
  registry.fit2cloud.com/halo/halo-pro:2.23</code></pre>
<h2 style="" id="jar-%E9%83%A8%E7%BD%B2">JAR 部署</h2>
<p style="">JAR 部署方式下，社区版和付费版对应不同的 JAR 文件：</p>
<div class="markdown-edited">
 <table>
  <thead>
   <tr>
    <th>版本</th>
    <th>JAR 文件名</th>
    <th>下载地址</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td>社区版</td>
    <td><code>halo-&lt;version&gt;.jar</code></td>
    <td><a href="https://github.com/halo-dev/halo/releases">GitHub Releases</a></td>
   </tr>
   <tr>
    <td>付费版</td>
    <td><code>halo-pro-&lt;version&gt;.jar</code></td>
    <td><a href="https://download.halo.run">download.halo.run</a></td>
   </tr>
  </tbody>
 </table>
</div>
<p style=""><strong>停止正在运行的 Halo 服务</strong></p>
<pre><code class="language-bash">service halo stop</code></pre>
<p style=""><strong>下载付费版 JAR 包，覆盖原文件</strong></p>
<pre><code class="language-bash">wget https://dl.halo.run/release/halo-pro-2.23.0.jar -O ~/app/halo.jar</code></pre>
<p style=""><strong>启动服务</strong></p>
<pre><code class="language-bash">service halo start</code></pre>
<p style="">工作目录（<code>~/.halo2</code>）、配置文件（<code>application.yaml</code>）以及 systemd service 文件均无需任何修改。</p>
<h2 style="" id="%E6%BF%80%E6%B4%BB%E8%AE%B8%E5%8F%AF%E8%AF%81">激活许可证</h2>
<p style="">切换到付费版镜像后，Halo 会正常启动，此时功能与社区版相同。如需解锁专业版或商城版的专属功能，需要购买并激活对应的许可证。</p>
<ul>
 <li>
  <p style="">购买许可证：<a href="https://www.lxware.cn/halo?code=mcYhwMkn" target="_blank" rel="">https://www.lxware.cn/halo</a></p>
 </li>
 <li>
  <p style="">激活方式：参考<a href="https://docs.halo.run/user-guide/activate" target="_blank" rel="" class="ui-citation-link">许可证激活</a></p>
 </li>
</ul>
<p style="">如果暂时不需要付费版专属功能，无需激活，站点可以继续正常使用。</p>]]></description><guid isPermaLink="false">/archives/switch-to-halo-pro-and-ecommerce-edition</guid><dc:creator>Ryan Wang</dc:creator><category>运维</category><pubDate>Sat, 11 Apr 2026 16:44:00 GMT</pubDate></item><item><title><![CDATA[Halo 是什么？]]></title><link>https://www.halo.run/archives/what-is-halo</link><description><![CDATA[<img src="https://www.halo.run/plugins/feed/assets/telemetry.gif?title=Halo%20%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F&amp;url=/archives/what-is-halo" width="1" height="1" alt="" style="opacity:0;">
<p style=""><strong>Halo</strong>（发音：[ˈheɪloʊ]）是一款<strong>强大易用的开源建站工具</strong>。无论你想搭建个人博客、知识库，还是企业官网、在线商城，Halo 都能帮你一站式完成。</p>
<div data-type="gallery" data-group-size="3" data-layout="auto" data-gap="8">
 <div style="display: grid; gap: 8px;">
  <div data-type="gallery-group" style="display: flex; flex-direction: row; justify-content: center; gap: 8px;">
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-scene-25-01-14-4.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-scene-25-01-14-3.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-scene-25-01-14-2.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
  </div>
  <div data-type="gallery-group" style="display: flex; flex-direction: row; justify-content: center; gap: 8px;">
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-scene-25-01-14-1.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-ai-25-01-14-1.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-core-25-01-14-1.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
  </div>
  <div data-type="gallery-group" style="display: flex; flex-direction: row; justify-content: center; gap: 8px;">
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-extension-25-01-14-3.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-extension-25-01-14-5.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
   <div style="flex: 1.5 1 0%;" data-aspect-ratio="1.5">
    <img src="https://www.halo.run/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri?uri=https%3A%2F%2Fwww.halo.run%2Fupload%2Fhome-features-extension-25-01-14-2.png&amp;size=m" data-type="gallery-image" style="width: 100%; height: 100%; margin: 0; object-fit: cover;">
   </div>
  </div>
 </div>
</div>
<h2 style="" id="%E6%A0%B8%E5%BF%83%E5%AE%9A%E4%BD%8D"><strong>核心定位</strong></h2>
<p style="">Halo 的目标很简单：让任何人都能低门槛地拥有一个属于自己的网站，同时给开发者足够的灵活性去自定义和扩展。</p>
<p style="">它诞生于开源社区，遵循 <strong>GPL-v3.0</strong> 协议，源代码完全公开，任何人都可以免费使用、修改和部署。</p>
<h2 style="" id="%E4%BA%94%E5%88%86%E9%92%9F%E4%B8%8A%E6%89%8B"><strong>五分钟上手</strong></h2>
<p style="">如果你本地有 Docker 环境，一行命令即可启动：</p>
<pre><code class="language-shellscript">docker run -d --name halo -p 8090:8090 -v ~/.halo2:/root/.halo2 halohub/halo:2</code></pre>
<p style="">不想折腾本地环境？官方提供了一个<a href="https://demo.halocms.site/" target="_blank" rel="noopener noreferrer">在线 Demo</a>，后台地址是 <code>/console</code>，用账号 <code>demo</code> / <code>P@ssw0rd123..</code> 即可登录体验完整功能。</p>
<p style="">生产环境推荐按照<a href="https://docs.halo.run/category/%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97" target="_blank" rel="">安装指南</a>进行部署。</p>
<h2 style="" id="%E4%B8%89%E4%B8%AA%E7%89%88%E6%9C%AC%EF%BC%8C%E6%BB%A1%E8%B6%B3%E4%B8%8D%E5%90%8C%E9%9C%80%E6%B1%82"><strong>三个版本，满足不同需求</strong></h2>
<p style="">Halo 目前提供三个版本，适合不同规模和场景的用户：</p>
<p style=""><a href="https://github.com/halo-dev/halo"><strong>社区版</strong></a>：面向个人开发者和技术爱好者。零成本搭建博客、作品集、技术文档站，可以使用超过 100 款免费主题和插件。</p>
<p style=""><a href="https://www.lxware.cn/halo?code=mcYhwMkn"><strong>专业版</strong></a>：在社区版基础上增加了 10+ 高价值功能，包括：移动端 APP、AI 智能建站、手机号验证登录、全站私有化部署，以及付费主题和插件市场（SEO 优化、付费阅读、AI 助手等）。</p>
<p style=""><a href="https://www.lxware.cn/halo?code=mcYhwMkn"><strong>商业版</strong></a>：面向有电商需求的用户，集成了完整的在线商城能力：商品管理、订单处理、支付对接（微信支付、支付宝），实现品牌官网 + CMS + 线上店铺的一体化落地。</p>
<h2 style="" id="%E4%B8%B0%E5%AF%8C%E7%9A%84%E7%94%9F%E6%80%81"><strong>丰富的生态</strong></h2>
<p style="">Halo 拥有活跃的主题和插件生态，可以在<a href="https://www.halo.run/store/apps" target="_self" rel="">官方应用市场</a>浏览所有适配 Halo 2.x 的资源，也可以去 <a href="https://github.com/halo-sigs/awesome-halo" target="_blank" rel="noopener noreferrer">awesome-halo</a> 仓库发现社区贡献的优质内容。</p>
<h2 style="" id="%E6%80%BB%E7%BB%93"><strong>总结</strong></h2>
<p style="">如果你在寻找一个<strong>自托管、可扩展、开源免费</strong>的建站工具，Halo 值得一试。它的上手门槛极低（一行 Docker 命令），但能力上限却足够高，从个人博客到商业电商，都在它的覆盖范围之内。</p>
<ul>
 <li>
  <p style="">官网：<a href="https://www.halo.run" target="_self" rel="">www.halo.run</a></p>
 </li>
 <li>
  <p style="">文档：<a href="https://docs.halo.run/" target="_blank" rel="noopener noreferrer">docs.halo.run</a></p>
 </li>
 <li>
  <p style="">社区：<a href="https://bbs.halo.run/" target="_blank" rel="noopener noreferrer">bbs.halo.run</a></p>
 </li>
</ul>
<p style=""></p>]]></description><guid isPermaLink="false">/archives/what-is-halo</guid><dc:creator>Ryan Wang</dc:creator><category>Halo 101</category><pubDate>Fri, 10 Apr 2026 16:51:45 GMT</pubDate></item></channel></rss>