CentOS 安装免费 Let’s Encrypt SSL 证书

本页内容

CentOS 安装免费 Let’s Encrypt SSL 证书教程。

安装

CentOS 8

1# curl -O https://dl.eff.org/certbot-auto
2# mv certbot-auto /usr/local/bin/certbot-auto
3# chmod 0755 /usr/local/bin/certbot-auto

CentOS 7

1# yum install certbot-nginx

生成证书

CentOS 8

1# /usr/local/bin/certbot-auto --nginx -d errlogs.com -d www.errlogs.com

CentOS 7

1# certbot --nginx -d errlogs.com -d www.errlogs.com
  • -d 指定域名

自动更新

证书有效期为三个月,我们需要添加定时任务自动更新证书。

1# crontab -e
2# CentOS 8
32 0 * * * /usr/local/bin/certbot-auto renew --dry-run
4
5# CentOS 7
62 0 * * * /usr/bin/certbot renew --quiet
7
8# systemctl reload crond