Create: 2021-12-15
Update: 2026-09-28
申请免费 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.logCloudFlare Origin证书
cf的15年证书真好用
SSL/TLS-源服务器,然后直接配置即可,可以结合本文食用
ssl_certificate /etc/nginx/cert/fullchain.pem;
ssl_certificate_key /etc/nginx/cert/privkey.pem;持续更新中