CentOS7 安装letsencrypt
1.安装certbot
yum install certbot
2.获取证书
使用certbot certonly
命令然后根据提示操作即可
获取完之后可以通过certbot certificates
命令查看证书
3. 在nginx增加配置
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/www.yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.yourdomain.com/privkey.pem;
service nginx reload;
4.定期更新证书
certbot renew
4.1 设置任务计划定时更新
0 1 1 */2 * /usr/local/cronlist/renewletsencrypt.sh &
sh脚本内容:
#!/bin/bash
sudo certbot renew;
sudo /etc/init.d/nginx reload;