【问题标题】:Docker + NGINX + SSL码头工人 + NGINX + SSL
【发布时间】:2016-04-18 23:23:16
【问题描述】:

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

我通过 Docker 部署了它,扩展了标准的“nginx”镜像。我有理由确定我的 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;
    }
  }

【问题讨论】:

    标签: ssl nginx docker


    【解决方案1】:

    用户错误:

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

    我通过在本地测试 nginx(将 /etc/hosts 条目添加到“伪造”我的产品服务器)发现了这一点,并且它正常工作(在 docker 之外)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-22
      • 1970-01-01
      • 1970-01-01
      • 2019-10-12
      • 2020-11-06
      • 1970-01-01
      • 2017-02-01
      • 2016-01-18
      相关资源
      最近更新 更多