> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiIzNDAyYzc1ZC1lNjQzLTQzNzEtOGVhZi0wM2MzZDkzNTI2ZDciLCJleHAiOjE3Nzg0ODg4NzYsImlhdCI6MTc3ODQ4ODU3Nn0.2P58a4MI3iu0ml2vWtpCZ_btM8ToflPtBVFslT5fOvU
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 设置自定义域名

> 使用 Fern Dashboard 配置您的自定义域名，为子域名、子路径或根域名托管配置 DNS 记录。

[管理员](/learn/dashboard/configuration/permissions) 可以使用 [Fern Dashboard](https://dashboard.buildwithfern.com/) 配置以下任一自定义域名类型：

* **子域名**：`docs.mydomain.com`
* **子路径**：`mydomain.com/docs`
* **根域名**：`mydomain.com`

Dashboard 会根据您的域名类型自动提供正确的 DNS 记录。

<Note>
  或者，您可以[通过手动配置 DNS 记录来设置自定义域名](/learn/docs/preview-publish/setting-up-your-domain)。
</Note>

## 设置

<Steps>
  <Step title="打开 Dashboard">
    导航到 [Fern Dashboard](https://dashboard.buildwithfern.com/) 并选择您的文档站点。
  </Step>

  <Step title="添加您的自定义域名">
    在**概述**选项卡的**域名**部分，选择**添加自定义域名**并输入您的域名。Dashboard 会显示您需要配置的 DNS 记录。
  </Step>

  <Step title="在 `docs.yml` 中更新域名">
    将您的 `custom-domain` 添加到 `docs.yml` 配置中：

    ```yaml docs.yml
    instances:
      - url: example.docs.buildwithfern.com
        custom-domain: docs.mydomain.com
    ```
  </Step>

  <Step title="配置 DNS 记录">
    登录到您的域名注册商并添加 Fern Dashboard 中显示的 DNS 记录。具体记录取决于您的域名类型（子域名、子路径或根域名）。
  </Step>

  <Step title="验证设置">
    添加 DNS 记录后，返回 Fern Dashboard 验证您的域名。SSL 会为您的域名自动配置，但可能需要几分钟才能在全球范围内传播。

    <Tip>
      检查您是否可以从移动设备或无痕浏览器访问您的新文档站点。
    </Tip>
  </Step>
</Steps>