购买证书,搭建https服务器:
证书是在godaddy购买,购买细节流程不在详述,最终购买的是通配符的证书 Standard Wildcard SSL,如*.domain.com,支持信用卡和支付宝,时价是1892元/年,业务使用比较急,先自掏腰包,走的支付宝付款。
购买完成,下载解压后,目录中有两个文件,一个是证书,另一个gd_bundle-g2-g1.crt,现在不知这个是干啥的。
马上配置nginx
1
2
3
|
ssl on; ssl_certificate /ssl_location/yourdomain.com.crt; ssl_certificate_key /ssl_location/yourdomain.com.key; |
配好后,使用firefox ie chrome浏览器测试,一切ok。
但是让研发同学测试时,Safari还是This certificate was signed by an unknown authority.通过查看Safari的证书厂商,发现里面没有godaddy。推测是证书链断了。
google之,确实是证书链断了,需要把gd_bundle-g2-g1.crt和自己的证书保存为一个文件,供游览器向上爬证书链。方法如下:
cat yourdomain.com.crt gd_bundle-g2.crt > yourdomain.com_combined.crt
重新配置nginx
1
2
3
|
ssl on; ssl_certificate /ssl_location/yourdomain.com_combined.crt; ssl_certificate_key /ssl_location/yourdomain.com.key; |
之后再测试,测试通过。
解决过程中也找到了apache的配置方法,如下,apache支持证书链bundle文件
1
2
3
4
|
SSLEngine On SSLCertificateFile /ssl_location/yourdomain.com.crt SSLCertificateKeyFile /ssl_location/yourdomain.com.key SSLCertificateChainFile /ssl_location/gd_bundle.crt |
深坑,请大家注意,此问题影响线app正常打开,差点没被领导骂死。
您可以选择一种方式赞助本站
支付宝转账赞助
