> ## Documentation Index
> Fetch the complete documentation index at: https://enterprise-docs.dify.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Nginx Ingress 控制器

## 如何安装 Nginx Ingress Controller

你可以执行以下命令，在 Kubernetes 集群中安装 Nginx Ingress Controller：

```bash theme={null}
kubectl apply -f ./ingress-nginx-controller-v1.12.1.yaml
```

> 👉 <a href="https://assets-docs.dify.ai/2025/07/727045c765d5052ef3cc2f4b15aaa492.yaml" download="ingress-nginx-controller-v1.12.1.yaml">点击此处</a> 下载 `ingress-nginx-controller-v1.12.1.yaml` 文件。

## 如何配置 Nginx Ingress Controller

如果你使用的是 Nginx Ingress Controller，请确保在 `annotations` 字段中设置文件上传大小限制：

```yaml theme={null}
ingress:
  enabled: true
  className: "nginx"
  annotations: {
    # 设置文件上传大小限制
    nginx.ingress.kubernetes.io/proxy-body-size: "15m"
  }
  ... ...
```

***

## 如何访问 Dify Enterprise

完成 Ingress Controller 安装后，请先获取 Ingress Controller 的外部 IP：

```bash theme={null}
kubectl get svc -n ingress-nginx
```

然后，将获取到的外部 IP 添加到本地机器的 `/etc/hosts` 文件中，如下所示：

```bash theme={null}
4.152.1.216 console.dify.local
4.152.1.216 app.dify.local
4.152.1.216 api.dify.local
4.152.1.216 upload.dify.local
4.152.1.216 enterprise.dify.local
```

## 如果你使用其他 Ingress Controllers 应该怎么办？

* 一般来说，云服务提供商会有自己的 Ingress Controller。你可以使用云服务提供商的 Ingress Controller。有关更多信息，请参考 [Kubernetes 文档](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/)。
* `文件上传大小限制`：你可能需要在 Ingress Controller 配置的 `annotations` 字段中设置文件上传大小限制。例如，对于 Nginx Ingress Controller，你可以使用 `nginx.ingress.kubernetes.io/proxy-body-size: "15m"`。
* `审计日志 IP`：你应该在 Ingress Controller 中配置 `X-Forwarded-For` 头，以传递客户端的真实 IP 地址。
