首页 / 技术分享 / 服务器 /
Ali ECS Ubuntu Certbot 设置 https

Ali ECS Ubuntu Certbot 设置 https

码不停提

2026-05-20
31 次浏览
0 条评论

免费ssl证书

服务器
ECS
Ubuntu
Certbot
Https
LetsEncrypt
分享:

ECS 安全组放开 80, 443

安装 Certbot

# 1. 更新并安装 snapd(Ubuntu 一般自带)
sudo apt update
sudo apt install snapd -y

# 2. 升级 core,避免旧版冲突
sudo snap install core
sudo snap refresh core

# 3. 安装 certbot
sudo snap install --classic certbot

# 4. 做软链接,方便直接敲 certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

# 5. 验证
certbot --version

解析域名到服务器

通过 Certbot 添加 https

# 自动检测 Nginx 配置、申请证书、重定向 http→https
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

添加定时任务,自动更新 https

crontab -e

# 添加
0 3 15 * * /usr/bin/certbot renew --quiet && systemctl reload nginx

手动强制续期

sudo certbot renew --force-renewal

查看证书剩余天数

certbot certificates

评论区 (0)

你需要先 登录 后才能发表评论。
还没有人评论,赶快成为第一个吧。