SSL:服务器证书链不完整

Ada*_*dam 6 ssl certificate nginx node.js pci-compliance

我从https://www.ssls.com/购买了 PositiveSSL Wildcard

我收到了 3 个文件 a .ca-bundlea.crt和 a .p7b

我使用 NGINX 配置了证书,但收到错误:

“服务器证书链不完整”

https://www.ssllabs.com/ssltest/analyze.html?d=api.billgun.com

我怎样才能解决这个问题?

mx0*_*mx0 4

服务器证书链不完整

意味着您没有中间证书、证书已过期或顺序错误。

您似乎没有任何中间证书:https://www.sslshopper.com/ssl-checker.html#hostname=https://api.billgun.com/

当您在浏览器中打开站点时,您将获得绿色挂锁,因为浏览器可以下载缺少的中间证书,但其他工具将无法连接即。curl:

curl -I 'https://api.billgun.com/'
curl: (60) server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
More details here: http://curl.haxx.se/docs/sslcerts.html
Run Code Online (Sandbox Code Playgroud)

或者openssl

openssl s_client -connect api.billgun.com:443
CONNECTED(00000003)
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.billgun.com
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 OU = Domain Control Validated, OU = PositiveSSL Wildcard, CN = *.billgun.com
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
 0 s:/OU=Domain Control Validated/OU=PositiveSSL Wildcard/CN=*.billgun.com
   i:/C=GB/ST=Greater Manchester/L=Salford/O=COMODO CA Limited/CN=COMODO RSA     Domain Validation Secure Server CA
---
Run Code Online (Sandbox Code Playgroud)

生成正确链的最快方法是:

  • 在浏览器中打开您的网站
  • 单击绿色挂锁并显示证书属性
  • 导出链中的每个-billguncom.crt证书(在您的情况下,您应该获得 3 个文件: , COMODORSADomainValidationSecureServerCA.crt, COMODORSACertificationAuthority.crt
  • 按从叶证书到根证书的顺序组合文件:

    cat -- -billguncom.crt COMODORSADomainValidationSecureServerCA.crt COMODORSACertificationAuthority.crt > billgun_com.crt
    
    Run Code Online (Sandbox Code Playgroud)
  • 在服务器上安装新证书

  • 测试nginx配置nginx -t
  • 重启服务器service nginx restart