博客图床升级 HTTPS

今天更新一篇博客时发现图片显示不出来了

F12 发现是 github.io 限制图片需要 https 才能访问

被迫升级下图床到 https,好在还有免费证书 Let’s Encrypt 用,太强了

安装 acme.sh

1
2
3
curl https://get.acme.sh | sh
# 或者
wget -O - https://get.acme.sh | sh

Standalone 模式

1
2
3
4
5
# 确保你的 80 端口未被占用,域名自己写,可以添加多个
acme.sh --issue -d exp.example.com --standalone

# 使用 443 端口
acme.sh --issue -d exp.example.com --standalone --tls

DNS 手动模式

1
2
# 手动执行
acme.sh --issue --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please -d www.example.com

1
2
# 手动添加 txt 到域名控制台以后
acme.sh --renew --yes-I-know-dns-manual-mode-enough-go-ahead-please -d www.example.com

添加证书到七牛云

Aliyun 自动模式

1
2
3
4
5
6
# 设置环境变量
export Ali_Key="foo"
export Ali_Secret="bar"

# 使用 aliyun dns 自动更新证书
acme.sh --issue --dns dns_ali -d www.example.com

将证书部署到七牛

1
2
3
4
5
6
# 设置环境变量
export QINIU_AK="foo"
export QINIU_SK="bar"

# 运行 acme.sh 命令部署到七牛
acme.sh --deploy -d www.example.com --deploy-hook qiniu

定时脚本

1
2
3
4
5
# acme.sh 已经创建了定时任务,会定期更新证书
10 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null

# 设置每月1号执行
0 0 1 * * "/root/.acme.sh"/acme.sh --deploy -d www.example.com --deploy-hook qiniu --home "/root/.acme.sh" > /dev/null
作者

housirvip

发布于

2020-09-14

更新于

2023-01-01

许可协议

评论