阿里云服务器更换第三方SSL证书


因为第三方服务的价格是阿里的一半不到,和老板商量后决定就用这家公司的证书,结果中间频出意外倒腾了好久才换成功,记录一下

下载证书文件

一般供应商的客服人员会提供相关文件,我这次是nginx部署的,只需要.key和.pem两个文件即可,下载成功后上传到nginx的cert文件夹

# 我是在这个目录下存放证书文件的,后续在nginx配置时就填这个路径
 cd usr/local/nginx/conf/cert/

修改nginx证书配置

打开nginx的config文件,

cd ../conf
vi nginx.conf
    server {

        
        listen 443 ssl;
        server_name ${域名};

        ssi on;
        ssi_silent_errors on;
        #ssi_types text/html;
        
        ssl on;
        # 修改这里的配置文件目录及文件名
        ssl_certificate cert/xxxx.cn.pem;
        # .key文件同理
        ssl_certificate_key cert/xxxx.cn.key;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout 5m;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;  #使用此加密套件。
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;   #使用该协议进行配置。       
        ssl_prefer_server_ciphers on;

        location / {
            root   /mizhi/btbs/web/mizhi-btbs-pc;
            index  index.html index.htm;
        }
        location ^~ /api/env {
            root   /mizhi/btbs/web/mizhi-btbs-pc;
            index  index.html index.htm;
        }
        location ^~ /api/trace{
            root   /mizhi/btbs/web/mizhi-btbs-pc;
            index  index.html index.htm;
        }
        location ^~ /api/mappings{
            root   /mizhi/btbs/web/mizhi-btbs-pc;
            index  index.html index.htm;
        }
        location ^~ /api/base/upload/ {
             proxy_pass  http://zuul/zuul/btbs-base-service/upload/;
        }
        location ^~ /api/base/ws/ {
            proxy_pass  http://base-service/ws/;
        }
        location ^~ /api/base/ {
           # proxy_pass                 http://base-service/;
            proxy_pass  http://zuul/btbs-base-service/;
        }
        location ^~ /api/user/ws/ {
            proxy_pass  http://user-service/ws/;
        }
        location ^~ /api/user/ {
           proxy_pass  http://zuul/btbs-user-service/;      
        } 
        location /api/transaction/ {
           # proxy_pass                 http://ts-service/;
            proxy_pass  http://zuul/btbs-transaction-service/;
        }
        location /api/lg-ts/ {
            #proxy_pass                 http://lg-ts-service/;
            proxy_pass  http://zuul/btbs-lg-transaction-service/;
        }                        
        location /api/logistics/ {
            proxy_pass  http://zuul/btbs-logistics-service/;
        }
        location /api/financing/ {
            proxy_pass  http://zuul/btbs-financing-service/;
        }
        location  ^~ /api/contract/ {
            proxy_pass  http://zuul/btbs-contract-service/;
        }
        location  ^~ /api/order/ {
            proxy_pass  http://zuul/btbs-order-service/;
        } 
        location ^~ /api/btbs-oss/ {
            proxy_set_header Host "mizhi-btbs.oss-cn-hangzhou.aliyuncs.com";
            proxy_pass  http://mizhi-btbs.oss-cn-hangzhou.aliyuncs.com/;
        }
        location ^~ /api/ {
            proxy_pass  http://zuul/;
        }
    }
:wq

# 所有监听443端口的配置都需要配上新的证书!!!

修改域名TXT

我这边是用阿里云的域名管理的,这块应该都是大同小异,把域名解析中的TXT类型替换成供应商提供的内容即可。

阿里云SSL证书管理上传

在这里插入图片描述
这里上传证书只要把.key和.pem文件中的文本拷进去即可

在这里插入图片描述
我这边是OV通配符证书,选国际标准

证书名称自定义随便填

证书文件是.pem中的内容
证书私钥是.key中的内容

修改负载均衡证书配置

负载均衡用的还是阿里云的,也要同步修改证书配置
在这里插入图片描述

在这里插入图片描述
选择刚刚上传的证书即可

修改Web防火墙证书配置

在这里插入图片描述
当时SSL证书供应商的技术人员给我搞了好久一直没搞好,问题就是出在没有改Web应用防火墙的配置,导致443端口一直显示的还是旧的已过期的证书。

在这里插入图片描述
操作完成后查看小锁的证书更换成功

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值