证书过期处理

证书过期处理

方案一(推荐,Nginx 插件,无需停机)

sudo certbot certonly --nginx -d wxapi.lyforcdf.cn --force-renewal
sudo nginx -t && sudo systemctl reload nginx

方案二(短暂停机,用 standalone 验证)

sudo systemctl stop nginx
sudo certbot certonly --standalone -d wxapi.lyforcdf.cn --force-renewal
sudo systemctl start nginx

验证证书:

sudo certbot certificates --cert-name wxapi.lyforcdf.cn
openssl x509 -noout -dates -in /etc/letsencrypt/live/wxapi.lyforcdf.cn/fullchain.pem

检查端口是否有占用

root@VM-12-12-ubuntu:~# sudo netstat -tulpn | grep ':80\|:443'

若之后想用 Nginx 插件自动续期(避免占用80错误),执行一次方案一会自动更新 /etc/letsencrypt/renewal/wxapi.lyforcdf.cn.conf 的验证方式。