[GH-ISSUE #998] no "ssl_certificate" is defined for the "listen ... ssl" #7652

Closed
opened 2026-03-12 22:01:44 +03:00 by kerem · 1 comment
Owner

Originally created by @neobuilding on GitHub (May 2, 2025).
Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/998

Describe the bug
打开TLS,配置完证书之后,总是报错:
nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/nextcloud:1 nginx: configuration file /etc/nginx/nginx.conf test failed exit status 1

To Reproduce
Steps to reproduce the behavior:

  1. Go to '添加站点',进入第2步。或者修改站点。
  2. Click on '启用 TLS' 以启用它。
  3. Click on '更改证书' 以选择一个已有的证书,或者开启“用 Let's Encrypt 对网站进行加密”来申请一个新的证书。
  4. 完成其他配置后,点击保存。
  5. 将会自动进入高级模式并报错: nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/nextcloud:1 nginx: configuration file /etc/nginx/nginx.conf test failed exit status 1

Expected behavior
期待保存成功并能成功启用。

Screenshots

  1. 启用证书:
    Image

  2. 自动进入高级模式并报错:
    Image

Info (please complete the following information):

  • Server OS: QNAP QuTS hero h5.2.4.3079 + Container Station V3.0.9.1038 (Docker 27.1.2-qnap4, build d46fd47)
  • Server Arch: x86 (QNAP NAS)
  • Nginx UI Version: 2.0.0-rc.5 (397)
  • Your Browser: Edge 135.0.3179.98

Additional context

  • Docker compose for nginx-ui:
services:
    nginx-ui:
        image: 'docker.1ms.run/uozi/nginx-ui:latest'
        stdin_open: true
        tty: true
        container_name: nginx-ui
        restart: unless-stopped
        environment:
            - TZ=Asia/Shanghai
            - NGINX_UI_SERVER_PORT=28081
        volumes:
            - '/share/Container/volumes/nginx-ui/nginx:/etc/nginx'
            - '/share/Container/volumes/nginx-ui/nginx-ui:/etc/nginx-ui'
            - '/share/Container/volumes/nginx-ui/var-www:/var/www'
            - '/var/run/docker.sock:/var/run/docker.sock'
        network_mode: "host"
  • 生成的nginx config:
server {
    listen 28443;
    listen [::]:28443;
    server_name "";
    return 308 https://$host:28443$request_uri;
}
server {
    listen 28443 ssl;
    listen [::]:28443 ssl;
    server_name masked.xyz;
    ssl_certificate /etc/nginx/ssl/masked.xyz_P256/fullchain.cer;
    ssl_certificate_key /etc/nginx/ssl/masked.xyz_P256/private.key;
    location / {
        proxy_pass http://127.0.0.1:38080/;
    }
    location /.well-known/acme-challenge {
        proxy_set_header Host $host;
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
        proxy_pass http://127.0.0.1:9180;
    }
}
  • 已确认指定的证书文件存在:
    • ssl_certificate /etc/nginx/ssl/masked.xyz_P256/fullchain.cer;
    • ssl_certificate_key /etc/nginx/ssl/masked.xyz_P256/private.key;
Originally created by @neobuilding on GitHub (May 2, 2025). Original GitHub issue: https://github.com/0xJacky/nginx-ui/issues/998 **Describe the bug** 打开TLS,配置完证书之后,总是报错: nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/nextcloud:1 nginx: configuration file /etc/nginx/nginx.conf test failed exit status 1 **To Reproduce** Steps to reproduce the behavior: 1. Go to '添加站点',进入第2步。或者修改站点。 2. Click on '启用 TLS' 以启用它。 3. Click on '更改证书' 以选择一个已有的证书,或者开启“用 Let's Encrypt 对网站进行加密”来申请一个新的证书。 4. 完成其他配置后,点击保存。 5. 将会自动进入高级模式并报错: nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/sites-enabled/nextcloud:1 nginx: configuration file /etc/nginx/nginx.conf test failed exit status 1 **Expected behavior** 期待保存成功并能成功启用。 **Screenshots** 1. 启用证书: ![Image](https://github.com/user-attachments/assets/c998b0cf-7690-4e35-9dd8-c9ef0610a37e) 2. 自动进入高级模式并报错: ![Image](https://github.com/user-attachments/assets/946f40a9-39a4-4bea-a27d-b6c76056fc5f) **Info (please complete the following information):** - Server OS: QNAP QuTS hero h5.2.4.3079 + Container Station V3.0.9.1038 (Docker 27.1.2-qnap4, build d46fd47) - Server Arch: x86 (QNAP NAS) - Nginx UI Version: 2.0.0-rc.5 (397) - Your Browser: Edge 135.0.3179.98 **Additional context** - Docker compose for nginx-ui: ``` services: nginx-ui: image: 'docker.1ms.run/uozi/nginx-ui:latest' stdin_open: true tty: true container_name: nginx-ui restart: unless-stopped environment: - TZ=Asia/Shanghai - NGINX_UI_SERVER_PORT=28081 volumes: - '/share/Container/volumes/nginx-ui/nginx:/etc/nginx' - '/share/Container/volumes/nginx-ui/nginx-ui:/etc/nginx-ui' - '/share/Container/volumes/nginx-ui/var-www:/var/www' - '/var/run/docker.sock:/var/run/docker.sock' network_mode: "host" ``` - 生成的nginx config: ``` server { listen 28443; listen [::]:28443; server_name ""; return 308 https://$host:28443$request_uri; } server { listen 28443 ssl; listen [::]:28443 ssl; server_name masked.xyz; ssl_certificate /etc/nginx/ssl/masked.xyz_P256/fullchain.cer; ssl_certificate_key /etc/nginx/ssl/masked.xyz_P256/private.key; location / { proxy_pass http://127.0.0.1:38080/; } location /.well-known/acme-challenge { proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr:$remote_port; proxy_pass http://127.0.0.1:9180; } } ``` - 已确认指定的证书文件存在: - ssl_certificate /etc/nginx/ssl/masked.xyz_P256/fullchain.cer; - ssl_certificate_key /etc/nginx/ssl/masked.xyz_P256/private.key;
kerem 2026-03-12 22:01:44 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@neobuilding commented on GitHub (May 2, 2025):

搞定了,非ssl的监听端口和ssl的监听端口不能一样。

<!-- gh-comment-id:2846602079 --> @neobuilding commented on GitHub (May 2, 2025): 搞定了,非ssl的监听端口和ssl的监听端口不能一样。
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#7652
No description provided.