> For the complete documentation index, see [llms.txt](https://docs.verge.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.verge.io/knowledge-base/zh/tenants/configuring-proxy.md).

# 配置代理

使用代理可通过映射 FQDN 主机名，让多个租户环境共用 1 个 IP 地址。这绕过了每个租户需要 1 个 IP 地址的需求，并有助于保留 IPv4 地址。

### 启用代理

1. 从用于访问租户环境的外部网络：
   * 选择 **编辑** 在左侧菜单中。
   * 启用 **代理**.
   * 在大多数情况下， **Proxy Listen Address** 字段可以留空。默认将设为 `0.0.0.0`，这意味着它将监听所有地址。

{% hint style="warning" %}
**适用于 VergeOS 4.12.6 及更早版本**

如果网络中尚未使用“Bind DNS”，则需要临时启用它。这将使 UI 中显示 IP Alias 选择项（第 2 步）。

提交设置，但 ***暂时不要重启网络或应用规则！***
{% endhint %}

2. 从同一外部网络：

   * 选择 **IP 地址** 在左侧菜单中。
   * 编辑或创建一个 IP 地址，设置 **类型** 更改为 **IP Alias**.
   * 提交。
   * 将外部网络 DNS 改回原始设置（4.12.4 版本之前）。
   * 选择 **规则**.
   * 创建一条如下图所示的新规则：

   ![proxy\_accept\_rule.png](/files/25f1ef7d599440e5daf566a21fee0a4038131fd8)

   * 重启网络并应用规则。
   * 通过打开浏览器标签页并使用上一步分配的 IP Alias 地址导航到该 URL 来测试规则。如果正常工作，UI 登录页面将会在 IP Alias 地址上打开。

### 使用代理创建新租户

1. 创建一个 **A 记录** ，使你域名注册商中的新租户指向分配的 IP Alias。
2. 创建一个新租户：
   * 输入所有所需设置，保留 **URL** 为空。
3. 在 **UI 管理** 在租户创建页面的 **创建新的 FQDN**.
4. 在 **代理租户配置** 页面：
   * 选择代理服务运行所在的网络。
   * 选择租户名称。
   * 输入租户的 FQDN（第 1 步创建的 A 记录）。
   * 提交。
5. 选择 **跳过** 在 **UI 管理** 页面底部，以避免直接为租户分配 IP。

{% hint style="info" %}
**租户不能同时拥有 UI IP 地址和代理的 FQDN。**
{% endhint %}

6. 在新的租户仪表板中，选择 **应用代理** 中的高亮警告。
7. 启动租户，并在浏览器标签页中导航到其 URL 以登录。

### 编辑现有租户以使用代理

1. 创建一个 **A 记录** 为租户在你的域名注册商中设置指向分配的 IP Alias（如果尚不存在）。
2. 从租户仪表板中，选择 **编辑** 在左侧菜单中：
   * 在 **UI 地址** 字段，选择 **无**.
3. 导航到运行代理服务的网络：
   * 选择 **代理** 在左侧菜单中。
4. 从 **代理仪表板**:
   * 选择 **查看租户**.
   * 选择 **新建**.
5. 在 **代理租户配置** 页面：
   * 选择代理服务运行所在的网络。
   * 选择租户名称。
   * 输入租户的 FQDN（第 1 步创建的 A 记录）。
6. 导航到租户仪表板并选择 **应用代理** 中的高亮警告。
7. 从租户仪表板中选择租户网络（高亮显示）。

   ![tenant\_apply\_rules.png](/files/07856e44052f92dd8499081f15bf6bf33e4b83ea)
8. 选择 **应用规则** 中的高亮警告。
9. 在浏览器标签页中导航到其 URL 来测试对租户的访问。

***

{% hint style="info" %}
**文档信息**

* 最后更新：2024-08-29
* vergeOS 版本：4.12.6
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.verge.io/knowledge-base/zh/tenants/configuring-proxy.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
