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