LinMinquan's Blog

Experience technology to change life

javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.

同事给过来的错误,安卓App在调用时报的错。搜了下,是服务端的SSL没设置好,在相应的iOS App上这个是正常的,在安卓上有问题。

参考链接:okhttp使用https报 Trust anchor for certification path not found解决办法

参考链接2:SSL安装检查

链接3:下载中间证书

环境:Centos 6,Nginx,Let’s Encrypt

通过链接2可以检查有什么问题。我这边是缺少中间证书。解决办法是在链接3中操作,生成中间证书,下载下来是chain.crt。服务器中Nginx在用的证书的文件是Certificate.crt,然后把中间证书里的内容复制到Certificate.crt里(另起一行)。

检查一下Nginx的配置, sudo nginx -s reload

然后重启Nginx,sudo service nginx restart


Share