在通过ubuntu nginx设置SSL后,Docker端口无法通过https工作

问题描述 投票:0回答:1

我使用端口9998将Letsencrypt证书直接设置到运行Nginx的AWS EC2 Ubuntu实例和docker服务器。该域在Route 53上设置.Http被重定向到https。

所以https://example.com工作正常,但https://example.com:9998得到ERR_SSL_PROTOCOL_ERROR。如果我使用像http://10.10.10.10:9997这样的IP地址工作,并使用端口9998检查服务器没关系。

docker上服务器的快照是:

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
999111000        img-server         "/bin/sh -c 'java -j…"   21 hours ago        Up 21 hours         0.0.0.0:9998->9998/tcp   hellowworld

Nginx和使用端口9998的服务器之间似乎缺少某些东西。如何修复它?

docker nginx amazon-ec2 lets-encrypt
1个回答
0
投票

你在哪里配置了ssl证书?只有Nginx?

你不能使用ssl协议访问qazxsw poi的原因是该端口提供http服务而不是https。

我建议不要发布9998的hellowworld并用nginx代理所有流量(如果Nginx也是用docker和同一网络启动的话)。

在Nginx中配置https,origin服务器提供http。

这是https://example.com:9998的示例配置

https://github.com/newnius/scripts/blob/master/nginx/config/conf.d/https.conf
© www.soinside.com 2019 - 2024. All rights reserved.