Skip to content

[Bug] Enabling SSL on non-standard ports may lead to configuration anomalies #9082

@QingFeng-awa

Description

@QingFeng-awa

1Panel Version

Pro 2.0.1 (从节点,主节点没测)

Problem Description

在常规端口(例如我选的是8080)上勾选SSL会导致配置异常。

Steps to Reproduce

创建一个网站(我遇到的时候是用的.NET运行环境),并选用非常规端口(比如8080)。
勾选上对应域名的SSL,然后在下方启用HTTPS。
如果正常复现,你会发现HTTPS启用失败了。
进入配置页面,重载配置,错误信息复现。

Related log output

stderr: 2025/06/14 11:50:59 [emerg] 109#109: a duplicate listen [::]:8080 in /usr/local/openresty/nginx/conf/conf.d/XtremeWave-Normal.conf:3 nginx: [emerg] a duplicate listen [::]:8080 in /usr/local/openresty/nginx/conf/conf.d/XtremeWave-Normal.conf:3 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

Additional Information

这是当时发生错误的配置。

server {
    listen [::]:8080 ; 
    listen [::]:8080 ssl ; 
    listen [::]:80 ; 
    listen 8080 ssl ; 
    server_name n.cn.server.xtreme.net.cn; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    access_log /www/sites/XtremeWave-Normal/log/access.log main; 
    error_log /www/sites/XtremeWave-Normal/log/error.log; 
    location ^~ /.well-known {
        allow all; 
        root /usr/share/nginx/html; 
    }
    location / {
        proxy_pass http://127.0.0.1:22023; 
    }
    http2 on; 
    if ($scheme = http) {
        return 301 https://$host$request_uri; 
    }
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions