---
title: "自托管"
description: "用 Workers、D1、KV、R2、Queues 和 Durable Objects 在自己的 Cloudflare 账户运行 XID。"
locale: "zh-Hans"
---

> Documentation Index
> Fetch the locale documentation index at: https://xid.dev/zh-hans/llms.txt
> Use this file to discover all available pages before exploring further.

# 自托管

## 必需绑定

| 绑定 | 用途 |
| --- | --- |
| `DB` | D1 关系型存储。 |
| `CACHE` | 用于发现文档、密钥和品牌配置的 KV 缓存。 |
| `STORAGE` | 用于资产和导出的 R2 对象存储。 |
| `EMAIL_QUEUE` | 事务邮件队列。 |
| `AUDIT_QUEUE` | 审计事件队列。 |
| `SESSION_REVOCATION` | 用于会话吊销状态的 Durable Object。 |

## 必需密钥

| 密钥 | 用途 |
| --- | --- |
| `KEK` | 实例签名密钥的信封加密。 |
| `PEPPER` | 服务端密码和令牌哈希用 pepper 值。 |
| `BOOTSTRAP_TOKEN` | 保护自托管部署中的实例初始化。 |

## 部署检查

部署后，验证健康检查、OIDC 发现文档、JWKS、Hosted Auth 配置，以及至少一次来自实例签发方的授权跳转。

```shell
curl https://xid.dev/v1/health
curl https://xid.dev/.well-known/openid-configuration
curl https://xid.dev/jwks
curl https://xid.dev/auth/config
```

Source: https://xid.dev/zh-hans/self-hosting/index.mdx
