没有公网服务器的情况下使用acme.sh手动获取免费SSL证书

知识扫盲 2025-09-29

安装acme.sh

curl https://get.acme.sh | sh -s [email protected]
source ~/.bashrc

修改设置 :(执行原因:从 acme.sh v3.0 开始,默认 CA 现在是ZeroSSL,文档 我这里不打算用ZeroSSL)

acme.sh --set-default-ca --server letsencrypt

DNS模式签发:

acme.sh --issus  -d *.xxx.org --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please

--yes-I-know-dns-manual-mode-enough-go-ahead-please
作用是确认本次生成为全手动,acme本身支持调用域名厂商的API自动帮你添加记录,前提是需要配置各家API key。既然选择全手动,那么就需要声明。
23f4bc53816e2f5b7d47b4a47cf2f925.png

~/下载/Telegram$ acme.sh --issue  -d *.xxx.org --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please 
[2025年 09月 29日 星期一 16:00:05 CST] Using CA: https://acme-v02.api.letsencrypt.org/directory
[2025年 09月 29日 星期一 16:00:05 CST] Creating domain key
[2025年 09月 29日 星期一 16:00:06 CST] The domain key is here: /home/zhenghao/.acme.sh/*.xxx.org_ecc/*.xxx.org.key
[2025年 09月 29日 星期一 16:00:06 CST] Single domain='*.xxx.org'
[2025年 09月 29日 星期一 16:00:10 CST] Getting webroot for domain='*.xxx.org'
[2025年 09月 29日 星期一 16:00:10 CST] Add the following TXT record:
[2025年 09月 29日 星期一 16:00:10 CST] Domain: '_acme-challenge.xxx.org'
[2025年 09月 29日 星期一 16:00:10 CST] TXT value: 'OrqAQ.......vzKSrIQest-U'
[2025年 09月 29日 星期一 16:00:10 CST] Please make sure to prepend '_acme-challenge.' to your domain
[2025年 09月 29日 星期一 16:00:10 CST] so that the resulting subdomain is: _acme-challenge.xxx.org
[2025年 09月 29日 星期一 16:00:10 CST] Please add the TXT records to the domains, and re-run with --renew.

配置DNS解析,用来验证

根据命令行提示中的:
Domain
TXT value
去域名托管服务商添加一条TXT类型的DNS解析
解析名就是domain 解析值为TXT value

创建完解析后,命令行再次执行:

acme.sh --renew  -d *.xxx.org --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please
(base) zhenghao@zhenghao:~/下载/Telegram$ acme.sh --renew  -d *.xxx.org --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please 
[2025年 09月 29日 星期一 16:00:40 CST] The domain '*.xxx.org' seems to already have an ECC cert, let's use it.
[2025年 09月 29日 星期一 16:00:40 CST] Renewing: '*.xxx.org'
[2025年 09月 29日 星期一 16:00:40 CST] Renewing using Le_API=https://acme-v02.api.letsencrypt.org/directory
[2025年 09月 29日 星期一 16:00:41 CST] Using CA: https://acme-v02.api.letsencrypt.org/directory
[2025年 09月 29日 星期一 16:00:41 CST] Single domain='*.xxx.org'
[2025年 09月 29日 星期一 16:00:42 CST] Verifying: *.xxx.org
[2025年 09月 29日 星期一 16:00:44 CST] Pending. The CA is processing your order, please wait. (1/30)
[2025年 09月 29日 星期一 16:00:48 CST] Success
[2025年 09月 29日 星期一 16:00:48 CST] Verification finished, beginning signing.
[2025年 09月 29日 星期一 16:00:48 CST] Let's finalize the order.
[2025年 09月 29日 星期一 16:00:48 CST] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/2692135991/433011848561'
[2025年 09月 29日 星期一 16:00:49 CST] Downloading cert.
[2025年 09月 29日 星期一 16:00:49 CST] Le_LinkCert='https://acme-v02.api.letsencrypt.org/acme/cert/0530f113918cdf88a749b1f1369cac58712c'
[2025年 09月 29日 星期一 16:00:50 CST] Cert success.
-----BEGIN CERTIFICATE-----
MIIDiTCCAwsdff.....
.............................
.......sPIOtksqLIo8Z
-----END CERTIFICATE-----
[2025年 09月 29日 星期一 16:00:50 CST] Your cert is in: /home/zhenghao/.acme.sh/*.xxx.org_ecc/*.xxx.org.cer
[2025年 09月 29日 星期一 16:00:50 CST] Your cert key is in: /home/zhenghao/.acme.sh/*.xxx.org_ecc/*.xxx.org.key
[2025年 09月 29日 星期一 16:00:50 CST] The intermediate CA cert is in: /home/zhenghao/.acme.sh/*.xxx.org_ecc/ca.cer
[2025年 09月 29日 星期一 16:00:50 CST] And the full-chain cert is in: /home/zhenghao/.acme.sh/*.xxx.org_ecc/fullchain.cer

上述执行完毕后,证书的位置会打印在命令行,可以去指定目录查看


本文由 nobinobita 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

还不快抢沙发

添加新评论