Lxn-Chan!

(~ ̄▽ ̄)→))* ̄▽ ̄*)o

申请 Google 免费 SSL 证书全流程。

申请准备

首先打开 Google 首页,登录你的 Google 账号,随后转到 Google Cloud Platform 并新建一个 Google Cloud Project (如果需要)。

在保持登录的状态下打开 申请表单 并填写,等待 Google 给你发送邮件。

获得 Google Cloud Project ID

打开 https://console.cloud.google.com/apis/dashboard ,点击左上角你的项目名称,随后即可在弹出的列表中查看到你的 Project ID 。

获得 Account Key

启用API

打开如下链接,启用 API ,其中<Project ID>填写你刚才申请时使用的 Project ID 即可。

1
https://console.cloud.google.com/apis/library/publicca.googleapis.com?project=<Project ID>

打开该链接后点击“启用”,随后等待右侧出现“API已启用”则可以关闭该页。

申请Key

随后打开“Google Cloud Shell”(在右上角点击激活CloudShell图标)。

等待分配完成后在 Shell 窗口内输入如下命令:

1
2
gcloud config set project <Project ID>
gcloud beta publicca external-account-keys create

此时会弹出“为 Cloud Shell 提供授权”,点击授权即可。

执行完成后会返回类似如下输出;注意不要在没有收到 Google 的邮件时执行该命令,会返回命令不存在。

1
2
3
Created an external account key
[b64MacKey: xxx
keyId: xxx]

申请证书

安装 ACME

执行如下命令自动安装,注意替换自己的邮箱

1
curl https://get.acme.sh | sh -s email=<EMAIL>

注册账户

1
2
3
acme.sh --register-account -m <EMAIL> --server google \
--eab-kid xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
--eab-hmac-key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

签发证书

1
2
3
4
acme.sh -f --server google --issue \
-d test.domain \
-w "/home/root/web/certs/main" \
--reloadcmd "/etc/init.d/nginx reload"

如果想要 ECC 证书可以指定 key 类型。

安装证书

1
2
3
4
acme.sh -f --server google --issue \
-d test.domain --keylength ec-256\
-w "/home/root/web/certs/main" \
--reloadcmd "/etc/init.d/nginx reload"
  • -w参数指定证书输出位置;
  • --reloadcmd指定重启指令,如果你用的是 Apache2 还需要自行替换。

 简单说两句



联系站长 | 服务状态 | 友情链接

备案号:辽ICP备19013963号

萌ICP备 20219421 号

中国互联网违法和不良信息举报中心

架构版本号:8.1.6 | 本站已全面支持IPv6

正在载入运行数据(1/2)请稍后...
正在载入运行数据(2/2)请稍后...

Copyright 2024 LingXuanNing, All rights reserved.