# Comodo SSL 证书合并顺序及安装教程

**URL:** <https://www.shiqidu.com/t/topic/298>\
**Category:** 开发调优\
**Tags:** SSL\
**Created:** [2017 年11 月 24 日 03:05 UTC](https://www.shiqidu.com/t/topic/298 "2017-11-24T03:05:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

作者： ![Leon](https://www.shiqidu.com/user_avatar/www.shiqidu.com/leon/32/5_2.png) [@Leon](https://www.shiqidu.com/u/Leon)\
发布日期： [2017 年11 月 24 日 03:05 UTC](https://www.shiqidu.com/t/topic/298/1 "2017-11-24T03:05:32Z")

</div>

去年在bluehost买的ssl证书快到期了，今年趁着黑色星期五的活动买了一张通配符证书。

原价480rmb，用了百分之三十优惠码之后只要336rmb，需要ssl证书的小伙伴赶紧下手吧。[活动地址](https://cn.bluehost.com/coupon_blackfriday.html)

进入页面后选择SSL,拉倒下面就看到优惠码了，付款的时候把这个码输进去就行了。

![c602c4262cfa5b5301404016e92bbcb9.png](https://discourse.shiqidu.com/uploads_nj/article/20171124/c602c4262cfa5b5301404016e92bbcb9.png)

购买完毕，生成crt提交给comodo，几分钟后就能收到确认邮件了，邮件里应该包含4个证书文件。

![e7a087584f691000d92d084545fc7d5a.png](https://discourse.shiqidu.com/uploads_nj/article/20171124/e7a087584f691000d92d084545fc7d5a.png)

**根证书** - AddTrustExternalCARoot.crt  
**中级CA证书** - COMODORSAAddTrustCA.crt  
**中级CA证书** - COMODORSADomainValidationSecureServerCA.crt  
**你申请的通配符证书** - STAR\_shiqidu\_com.crt

要写安装到lnmp环境下被各大浏览器识别且不报安全错误，我们还需要合并一下这4个证书文件，生成一个最终的证书。

**合并时要注意顺序，不要错了。**

以linux/macos为例，合并的顺序应该是这样。

```bash
cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt >> STAR_shiqidu_com.crt    

```

![61b1d7d601b3296f9ce9d0762cbf1360.png](https://discourse.shiqidu.com/uploads_nj/article/20171124/61b1d7d601b3296f9ce9d0762cbf1360.png)

最终的这个 **STAR\_shiqidu\_com.crt** 才是我们要安装到nginx里的证书。

安装很简单，以nginx为例，打开你站点的配置文件。

```shell
server    
    {    
        listen 443 ssl;    
        server_name new.shiqidu.com;    
        index index.html index.htm index.php;    
        root /home/www/htdocs/domainroot/;    
        # 添加下面的四行代码  
        ssl_certificate /etc/nginx/csr/STAR_shiqidu_com/STAR_shiqidu_com.crt; #证书文件路径    
        ssl_certificate_key /etc/nginx/csr/myserver.key; #证书私钥文件路径    
        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;    
        ssl_ciphers HIGH:!ADH:!EXPORT56:RC4+RSA:+MEDIUM;    
    }    

```

大功告成，打开浏览器试试地址栏有没有变绿吧。

![1bfe9c98f9367534c84cc76b423b737e.png](https://discourse.shiqidu.com/uploads_nj/article/20171124/1bfe9c98f9367534c84cc76b423b737e.png)
