免费https证书申请

https证书申请

通过Let' s Encrypt进行免费https证书申请

  1. 官网网站
    首先在动手前,可以先去certbot看看,我觉得还是很有必要的啦!
  2. 安装certbot

    yum install epel-release -y
    yum install certbot
  3. 通配符证书申请命令
    执行命令中会去验证域名的所有者,也就是添加一条TXT记录到域名控制台。
    certbot certonly  -d *.test.com --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory

    完成后会显示域名所在目录

4、自动续期

echo "0 0,12 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && certbot renew" | sudo tee -a /etc/crontab > /dev/null

默认到期前30天续期,如果不满足可手动配置
/etc/letsencrypt/renewal/test.conf

5、证书清理
如果不想要了或者其他原因需要清理,执行以下命令即可

rm -rf /etc/letsencrypt/live/www.example.com/
rm -rf /etc/letsencrypt/archive/www.example.com/
rm /etc/letsencrypt/renewal/www.example.com.conf

猜你喜欢

转载自blog.51cto.com/11962757/2454255