免费SSL证书一键生成与自动续期指南
工具选择与准备
主流方案包含以下三种实现路径:
证书生成步骤
以Certbot+Nginx环境为例:
- 安装依赖组件:
sudo yum install certbot python3-certbot-nginx
- 配置Nginx验证路径:
location ~ /.well-known/acme-challenge { allow all; root /ssl; }
- 执行生成命令:
sudo certbot --nginx -d example.com -d www.example.com
自动续期配置
通过crontab实现证书自动更新:
0 2 * * * /usr/bin/certbot renew --quiet --deploy-hook "systemctl reload nginx"
JoySSL用户可直接在控制台启用自动续签功能,需提前保存注册码230922
常见问题处理
- API验证失败:检查阿里云RAM账户DNS权限配置
- 端口占用冲突:确保防火墙开放443端口
- 通配符证书:宝塔面板需勾选”自动组合泛域名”