[GH-ISSUE #1417] Upstream 容器不存在导致启动失败与 UI 无法访问 #6562

Closed
opened 2026-03-01 17:13:03 +03:00 by kerem · 4 comments
Owner

Originally created by @Time-w on GitHub (Oct 31, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1417

Describe the bug
当 Nginx UI 配置包含容器引用的 upstream时,如果对应容器不存在或无法启动,
Nginx UI 在重启时会报错并陷入死循环,无法进入 Web 管理界面。

To Reproduce
Steps to reproduce the behavior:

  1. 在 Nginx UI 中配置以下内容:
   upstream schedule-admin {
       ip_hash;
       server schedule_admin:8010;
   }
  1. 保存配置并应用。

  2. 停止或删除 schedule_admin 容器。

  3. 重启 Nginx UI。

  4. Nginx UI 启动失败,并持续报错:

    nginx: [emerg] host not found in upstream "schedule_admin:8010"
    
  5. Web UI 无法访问,陷入无法恢复的循环。

Expected behavior
即使某个 upstream 容器不存在,也希望:

  • Nginx UI 能正常启动;

  • 在 UI 中可以禁用或修改该站点配置;

  • 而不是整个系统陷入启动失败的死循环。

Screenshots
如果适用,请添加截图以帮助说明问题。

Info (please complete the following information):

  • Server OS: Ubuntu 22.04

  • Server Arch: x86_64

  • Nginx UI Version: v2.1.14 或 v2.1.17

  • Your Browser: Chrome 128

Additional context
建议:

  • 当 Nginx 启动失败时,Nginx UI 仍然能以“安全模式”启动;

  • 提供一个可视化入口禁用出错的站点;

  • 或者在检测到 upstream host 不存在时,自动跳过加载相关配置。

Originally created by @Time-w on GitHub (Oct 31, 2025). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/1417 **Describe the bug** 当 Nginx UI 配置包含容器引用的 upstream时,如果对应容器不存在或无法启动, Nginx UI 在重启时会报错并陷入死循环,无法进入 Web 管理界面。 **To Reproduce** Steps to reproduce the behavior: 1. 在 Nginx UI 中配置以下内容: ```nginx upstream schedule-admin { ip_hash; server schedule_admin:8010; } ``` 2. 保存配置并应用。 3. 停止或删除 `schedule_admin` 容器。 4. 重启 Nginx UI。 5. Nginx UI 启动失败,并持续报错: ``` nginx: [emerg] host not found in upstream "schedule_admin:8010" ``` 6. Web UI 无法访问,陷入无法恢复的循环。 **Expected behavior** 即使某个 upstream 容器不存在,也希望: - Nginx UI 能正常启动; - 在 UI 中可以禁用或修改该站点配置; - 而不是整个系统陷入启动失败的死循环。 **Screenshots** 如果适用,请添加截图以帮助说明问题。 **Info (please complete the following information):** - Server OS: Ubuntu 22.04 - Server Arch: x86_64 - Nginx UI Version: v2.1.14 或 v2.1.17 - Your Browser: Chrome 128 **Additional context** 建议: - 当 Nginx 启动失败时,Nginx UI 仍然能以“安全模式”启动; - 提供一个可视化入口禁用出错的站点; - 或者在检测到 upstream host 不存在时,自动跳过加载相关配置。
kerem 2026-03-01 17:13:03 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@0xJacky commented on GitHub (Oct 31, 2025):

Nginx UI 是正常启动的,只不过需要单独暴露 nginx-ui 的端口出来。这个问题是 Nginx 的问题,与 Nginx UI 无关。

<!-- gh-comment-id:3471085791 --> @0xJacky commented on GitHub (Oct 31, 2025): Nginx UI 是正常启动的,只不过需要单独暴露 nginx-ui 的端口出来。这个问题是 Nginx 的问题,与 Nginx UI 无关。
Author
Owner

@Time-w commented on GitHub (Oct 31, 2025):

Nginx UI 是正常启动的,只需单独引入 nginx-ui 的端口出来。这个问题是 Nginx 的问题,与 Nginx UI 无关。

我有配置 UI 的端口 9000 ->9001 然后映射容器端口 访问的就是 UI 的端口 而不是映射的 80 是无法访问的
然后手动修改了站点文件 删除了upstream 的配置 那个报错没有了 就正常访问了

Image
<!-- gh-comment-id:3471092447 --> @Time-w commented on GitHub (Oct 31, 2025): > Nginx UI 是正常启动的,只需单独引入 nginx-ui 的端口出来。这个问题是 Nginx 的问题,与 Nginx UI 无关。 我有配置 UI 的端口 9000 ->9001 然后映射容器端口 访问的就是 UI 的端口 而不是映射的 80 是无法访问的 然后手动修改了站点文件 删除了upstream 的配置 那个报错没有了 就正常访问了 <img width="524" height="334" alt="Image" src="https://github.com/user-attachments/assets/82c44e47-0791-40cf-bfa9-38cfa410971e" />
Author
Owner

@0xJacky commented on GitHub (Nov 10, 2025):

经测试,Nginx 启动失败不影响 Nginx UI 的启动
Image

Image

您应该直接暴露 Nginx UI 的端口,而不是通过 Nginx 反代一次,否则 Nginx 未启动的时候,9001 是不通的

<!-- gh-comment-id:3510601692 --> @0xJacky commented on GitHub (Nov 10, 2025): 经测试,Nginx 启动失败不影响 Nginx UI 的启动 <img width="1884" height="1058" alt="Image" src="https://github.com/user-attachments/assets/f6734f19-f05e-4bd5-b8a2-d91ff1b6e446" /> <img width="1456" height="1486" alt="Image" src="https://github.com/user-attachments/assets/0aae5cc5-9aa2-4d5a-976b-5b8762b542d4" /> 您应该直接暴露 Nginx UI 的端口,而不是通过 Nginx 反代一次,否则 Nginx 未启动的时候,9001 是不通的
Author
Owner

@Time-w commented on GitHub (Nov 17, 2025):

既然 9000 能直接访问 UI 为何还要再配置 9000 转到 80 端口 访问, 为何不能直接映射 9000 访问,

我反代到 9001 是因为默认配置是 9000 反代到 80 我是内网使用 不会用到域名 ,所以我是可以直接删除默认的那个反代配置?

<!-- gh-comment-id:3539805860 --> @Time-w commented on GitHub (Nov 17, 2025): 既然 9000 能直接访问 UI 为何还要再配置 9000 转到 80 端口 访问, 为何不能直接映射 9000 访问, 我反代到 9001 是因为默认配置是 9000 反代到 80 我是内网使用 不会用到域名 ,所以我是可以直接删除默认的那个反代配置?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-ui#6562
No description provided.