Docker + NGINX + SSL

3

我有一个简单的NGINX代理配置(如下),使用了我的新SSL证书(这是我第一次尝试)。

我通过扩展标准的“nginx”镜像来使用Docker进行部署。我相当确定我的InstantSSL证书文件是有效的,但服务器没有返回有效的SSL连接。

我收到以下错误:

$ openssl s_client -connect MY_DOMAIN.com:443
CONNECTED(00000003)
22489:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake 

我也尝试过其他工具:

$ ./cipherscan -v https://MY_DOMAIN.com
handshake failed, no ciphersuite was returned

最后,https://www.ssllabs.com/ssltest/analyze.html 返回“不支持安全协议”。
我尝试了各种组合的ssl_protocolsssl_ciphers设置,但nginx文档表示默认设置应该没问题。
NGINX在80端口(即使用标准虚拟主机设置监听80)上运行良好,因此一般的服务器设置似乎没问题。
有没有其他建议?
  server {
    listen 443 ssl;

    server_name MY_DOMAIN.com;

    ssl on;
    ssl_certificate       /etc/ssl/ssl-bundle.crt;
    ssl_certificate_key   /etc/ssl/MY_DOMAIN.key;

    ssl_prefer_server_ciphers on;

    ssl_stapling on;
    ssl_stapling_verify on;

    location / {
      proxy_pass http://frontend;

      proxy_redirect http:// https://;

      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection 'upgrade';
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_cache_bypass $http_upgrade;
    }
  }
1个回答

0

用户错误:

我在我的Dockerfile中暴露了443端口,但是在我的Docker Cloud堆栈文件中没有(因此托管的容器端口被阻止)。

通过在本地测试nginx(添加一个/etc/hosts条目来“伪造”我的生产服务器),我找到了这个问题,并且它可以正确地工作(在docker之外)。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接