具有自定义端口配置的Nginx-ssl失败



我有以下nginx配置

server {
listen 4050;
listen 443 ssl;
server_name url ww.url;
location / {
proxy_pass http://localhost:6091;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}

ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

以上内容适用于访问http://domain:4050之后的http,但当我通过https://domain:4050使用https访问时失败

让它在4050端口上使用https,我缺少什么。

要使其与https一起工作,需要将listen 4050;更改为listen 4050 ssl;。但是,您将无法将其与http一起使用。

您不能将同一端口用于HTTP和HTTPS

相关内容

  • 没有找到相关文章

最新更新