Skip to content

Upstream 容器不存在导致启动失败与 UI 无法访问 #1417

@Time-w

Description

@Time-w

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;
    }

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 不存在时,自动跳过加载相关配置。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions