Create: 2021-12-15
申请免费 letsencrypt 证书
根据发行版安装 certbot
- Debian 系
apt-get install certbot- Arch 系
pacman -S certbot测试申请证书, $domain 指向自己的域名, 防止配置失败导致被限制申请
#--webroot-path 后请指向网站根目录
certbot certonly --webroot --webroot-path /var/www/html --renew-by-default --email email@$domain --text --agree-tos -d $domain -d www.$domain --test-cert
//测试是否能正常续费证书
certbot renew --dry-run
certbot certonly --webroot --webroot-path /var/www/html --renew-by-default --email email@$domain --text --agree-tos -d $domain -d www.$domain
申请的证书位置位于
"certificateFile": "/etc/letsencrypt/live/$domain/fullchain.pem",
"keyFile": "/etc/letsencrypt/live/$domain/privkey.pem"debian 系大部分自带 cron, 直接 crontab -e 即可
pacman -S cronie
systemctl enable cronie
systemctl start cronie
crontab -e
#每天凌晨 2.30 更新证书
30 2 * * * /usr/bin/certbot renew >> /var/log/le-renew.log持续更新中