> ## Documentation Index
> Fetch the complete documentation index at: https://dify-6c0370d8-docs-agent-app-service-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 常见问题

> 本文档由 AI 自动翻译。如有任何不准确之处，请参考 [英文原版](/en/self-host/deploy/quick-start/faqs)。

## 部署方法

### 安装旧版本

使用 `--branch` 标志来安装特定版本：

```bash theme={null}
git clone https://github.com/langgenius/dify.git --branch 0.15.3
```

其余设置与安装最新版本相同。

### 使用 ZIP 压缩包安装

对于网络受限环境或无法使用 git 的情况：

```bash theme={null}
# 下载最新版本
wget -O dify.zip "$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r '.zipball_url')"
unzip dify.zip && rm dify.zip
```

或者，在另一台设备上下载 ZIP 文件并手动传输。

**升级方法**：

```bash theme={null}
wget -O dify-latest.zip "$(curl -s https://api.github.com/repos/langgenius/dify/releases/latest | jq -r '.zipball_url')"
unzip dify-latest.zip && rm dify-latest.zip
rsync -a dify-latest/ dify/
rm -rf dify-latest/
cd dify/docker
docker compose pull
docker compose up -d
```

## 备份程序

### 升级前创建备份

升级前务必备份以防止数据丢失：

```bash theme={null}
cp -r dify "dify.bak.$(date +%Y%m%d%H%M%S)"
```

这将创建一个带时间戳的备份，便于轻松恢复。

## 反向代理配置

### 前端和后端使用不同子域名时登录会话失效

若已将 Web 和 API 拆分到不同子域名并部署在反向代理之后（例如 `app.example.com` 用于 UI，`api.example.com` 用于后端），认证 Cookie 无法同时到达两个主机。登录看似成功，但下一次请求时会话即丢失。

在 `.env` 中设置以下两个变量，然后重启 Dify：

* **`COOKIE_DOMAIN`**：设为前后端共享的顶级域名（例如 `example.com`），前导点可省略。
* **`NEXT_PUBLIC_COOKIE_DOMAIN`**：设为 `1`，启用前端的跨子域名 Cookie。

```bash theme={null}
docker compose down
docker compose up -d
```

Cookie 无法跨顶级域名共享，因此前端和后端必须位于同一可注册域名下。详见 [环境变量](/zh/self-host/deploy/configuration/environments)。
