如何在Linux上安装SSL证书

以下仅演示如果自动申请证书,如果你自己准备了证书,请查阅相关教程

安装 certbot 以及 certbot nginx 插件

$ sudo yum install certbot python2-certbot-nginx -y  

注:如果是 CentOS 7 可能出现安装错误, 根据提示进行修复即可

执行配置

中途会询问邮箱等基本信息,如实填写即可

$ sudo certbot --nginx  

安装成功后, 最末尾会出现以下提示信息

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/你的域名/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/你的域名/privkey.pem
   Your cert will expire on 2019-09-26. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

同时可以从以上输出信息中得到证书的 安装位置/etc/letsencrypt/live/你的域名/ 之下,其中会包含一个 README 文件来简述该文件夹下其他文件的含义,可自行查看

自动续约

用certbot安装免费SSL证书,其有效期只有6个月的时间,可以用以下命令开启 自动续约

$ sudo certbot renew --dry-run
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值