侧边栏壁纸
  • 累计撰写 27 篇文章
  • 累计创建 27 个标签
  • 累计收到 5 条评论

目 录CONTENT

文章目录

2025年最新谷歌证书申请全攻略!媲美商业证书,为你的网站保驾护航!

Administrator
2025-03-30 / 0 评论 / 0 点赞 / 156 阅读 / 0 字

准备工作:

一个谷歌账号,用来获取key。
一个VPS,用来在命令行申请证书。

获取 ID 和 KEY

打开下面链接:
https://console.cloud.google.com/apis/library/publicca.googleapis.com

选择Enable,激活 api 权限。

点击右上角 Cloud Shell 授权激活

然后在Cloud Shell中输入以下命令

gcloud beta publicca external-account-keys create

然后就会获取到ID 和 KEY ,格式如下

[b64MacKey: hahaahha
keyId: hahahaha]

VPS服务器中安装Certbot

apt install certbot

注册 acme 账号

certbot register \
    --email "你的邮箱" \
    --no-eff-email \
    --server "https://dv.acme-v02.api.pki.goog/directory" \
    --eab-kid "你的ID" \
    --eab-hmac-key "你的KEY"

注意此处的邮箱,要是你的申请key的谷歌邮箱

申请谷歌证书

certbot certonly \
    --manual \
    --preferred-challenges "dns-01" \
    --server "https://dv.acme-v02.api.pki.goog/directory" \
    --domains "*.你的域名,你的域名"

注意domains参数,要填写你的 泛解析域名 和你的根域名,中间用逗号分隔

按照命令提示要求,去你的域名服务提供商那里,添加txt解析
证书申请成功后会保存到 /etc/letsencrypt/live/ 目录。
把这个证书贴入你需要证书的地方,就可以使用了。

0

评论区