letsencrypt certbot https自动续期配置
2022-06-30 10:01 迷途的码农 阅读(678) 评论(0) 编辑 收藏 举报环境certos7
nginx
来此加密快速开始文档
先安装好snap
yum install epel-release yum install snapd systemctl enable --now snapd.socket sudo ln -s /var/lib/snapd/snap /snap
再按照如下教程安装certbot自动获取
sudo snap install --classic certbot sudo ln -s /snap/bin/certbot /usr/bin/certbot
上面两步已经安装完 下面开始拉证书
sudo certbot --nginx sudo certbot certonly --nginx
证书有效期是3个月 自动任务每3月续期一次
crontab -e 0 0 1 3,6,9,12 * sh /root/renewHttpsCert.sh
renewHttpsCert.sh内容
sudo certbot renew --force-renewal
异常情况:
Detail: Fetching http://domain/.well-known/acme-challenge/EueWlS27qFXsigK43xQ6Cb46v339iBZVU3JUgnU4yiE: Error getting validation data
The Certificate Authority failed to download the challenge files from the temporary standalone webserver started by Certbot on port 80. Ensure that the listed domains point to this machine and that it can accept inbound connections from the internet.
如果验证挑战文件失败 则需要手动安装
certbot certonly --manual
然后会手动生成一个验证串和一个文件内容
需要在 webroot/.well-known/acme-challenge 文件夹下生成一个文件 把生成的验证内容放入文件 然后验证即可生成证书。然后手动放入nginx配置 中
webroot/.well-known/acme-challenge
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)