Let’s Encrypt 的泛域名证书适合子域名比较多的站点。证书用 DNS-01 验证,所以签发的机器不必对公网开放 80 端口。申请、部署和续期可以分开做。
Let’s Encrypt的单域名SSL证书极大的推动了SSL证书在世界范围内的普及,而现在更加让人兴奋的消息是:经过无数次的跳票,Let’s Encrypt Wildcard 免费泛域名SSL证书终于上线了!任何个人都是可以免费申请,利用脚本Acme.sh可以实现一键签发,十分方便。
用 acme.sh 可以把签发、部署和续期连起来。证书有效期取决于所选配置,按实际到期时间核对,别把旧文的三个月当成固定续期周期。
本篇文章就来分享一下Let’s Encrypt Wildcard 免费泛域名SSL证书一键申请与SSL使用教程,更多的关于建站经验与建站资源,你可以试试:
PS:2026年11月5日更新,补上 DNS-01、裸域与通配符的覆盖差别,更新签发参数、DNS Token 和证书安装续期步骤。
PS:更新记录。
1、更多的免费SSL证书可以看我收集整理的专题:免费SSL证书收集整理汇总-免费给网站添加Https安全加密访问。2022.6.25 2、详细的letsencrypt免费SSL证书安装教程,参考:简单三步给网站申请安装letsencrypt免费SSL证书-acme.sh自动续期。2022.6.25
官网:
要安装Let’s Encrypt Wildcard 免费泛域名SSL证书,可以在能运行 acme.sh 的机器上签发,再部署到实际提供 HTTPS 的服务器,关于选购VPS主机可以看我写的各在VPS主机测评:接入CN2线路VPS主机商和机房汇总和VPS主机排行榜单。
不嫌备+案麻烦的话,可以选择阿里云VPS、腾讯云VPS、京东云VPS等国内的VPS主机商,想要速度快的免备+案的VPS,可以试试CN2线路或者香港、韩国机房的VPS,这类有阿里云香港、CN2 VPS、Kdatacenter等等。
先确认哪家服务商托管这个域名的权威 DNS。用它的 API 写入 _acme-challenge TXT 即可,通常无需更换 NS。*.example.com 只覆盖一级子域名,要同时覆盖裸域就再加 example.com。验证方式:https://letsencrypt.org/docs/challenge-types/ 。
acme.sh 实现了 acme 协议, 可以从 letsencrypt 生成免费的证书。安装很简单, 一个命令:
curl https://get.acme.sh | sh
普通用户和 root 用户都可以安装使用。 acme.sh 安装到你的 home 目录下:~/.acme.sh/,并创建 一个 bash 的 alias, 方便你的使用: acme.sh=~/.acme.sh/acme.sh
安装后检查当前账号下的定时任务。使用 DNS API 才便于自动续期;如果手动添加 TXT,续期时通常还得重新添加。下面的 DNS 界面和命令记录来自早期 acme.sh。
目前acme.sh需要使用到DNS API验证域名。这里以DNSPOD为例,进入到用户中心就可以找到API了。
点击新建一个API。
最后你可以复制API的ID与Key了。
这里以DNSPod为演示,如果你是使用的其它的DNS,请参考本文下的附录,不同的DNS的命令是不同的。执行以下命令保存DNSPOD的API Key 和 ID。
export DP_Id="1234"
export DP_Key="sADDsdasdgdsf"
这里的 dns_dp 对应旧版 DNSPod ID/Token 接口;使用腾讯云 API 的朋友按现行插件文档选择对应插件。签发命令显式指定 Let’s Encrypt,通配符用引号包起来:
acme.sh --issue --server letsencrypt --dns dns_dp -d example.com -d '*.example.com'
# 需要明确指定 ECC 曲线时可加 --keylength ec-256
acme.sh --issue --server letsencrypt --dns dns_dp -d example.com -d '*.example.com' --keylength ec-256
#可选长度有:
ec-256 (prime256v1, “ECDSA P-256”)
ec-384 (secp384r1, “ECDSA P-384”)
整个签发过程还是很快的,完成后你就可以生成的SSL证书路径了。
签发成功后,用 acme.sh --install-cert 把私钥和完整证书链部署到 Web 服务使用的路径,ECC 证书加 --ecc。同时配置能生效的 --reloadcmd;续期后从外部核对网站实际返回的证书及有效期。别让 Nginx 直接引用 acme.sh 的内部目录。
实际上目前流行的VPS主机面板都已经支持自定义SSL证书或者是一键申请安装Let’s Encrypt SSL证书了,例如BT.cn宝塔面板、OneinStack、LNMP、WDCP、AppNode面板等。 更多的安装方法请参考:服务器控制面板榜单。
说明:
-d www.example.com 换成 -d '*.example.com',保留裸域参数。4.1 CloudFlare DNS API
Cloudflare 新配置优先使用仅授权目标域名的 API Token,给它所需的 DNS 编辑及区域读取权限。
export CF_Token="YOUR_ZONE_API_TOKEN"
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_cf -d example.com -d '*.example.com'
acme.sh 会保存 DNS 插件的授权配置,限制对应文件的权限,续期时让同一账号读取。
4.2 DNSPod DNS API
First you need to login to your DNSPod account to get your API Key and ID.
export DP_Id="1234"
export DP_Key="sADDsdasdgdsf"
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_dp -d example.com -d www.example.com
The DP_Id and DP_Key will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.3 CloudXNS DNS API
First you need to login to your CloudXNS account to get your API Key and Secret.
export CX_Key="1234"
export CX_Secret="sADDsdasdgdsf"
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_cx -d example.com -d www.example.com
The CX_Key and CX_Secret will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.4 阿里云Aliyun DNS API
First you need to login to your 阿里云 Aliyun account to get your API key. https://ak-console.aliyun.com/#/accesskey
export Ali_Key="sdfsdfsdfljlbjkljlkjsdfoiwje"
export Ali_Secret="jlsdflanljkljlfdsaklkjflsa"
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_ali -d example.com -d www.example.com
The Ali_Key and Ali_Secret will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.5 GoDaddy DNS API
First you need to login to your GoDaddy account to get your API Key and Secret. https://developer.godaddy.com/keys/
Please create a Production key, instead of a Test key.
export GD_Key="sdfsdfsdfljlbjkljlkjsdfoiwje"
export GD_Secret="asdfsdafdsfdsfdsfdsfdsafd"
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_gd -d example.com -d www.example.com
The GD_Key and GD_Secret will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.6 PowerDNS DNS API
First you need to login to your PowerDNS account to enable the API and set your API-Token in the configuration. https://doc.powerdns.com/md/httpapi/README/
export PDNS_Url="http://ns.example.com:8081"
export PDNS_ServerId="localhost"
export PDNS_Token="0123456789ABCDEF"
export PDNS_Ttl=60
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_pdns -d example.com -d www.example.com
The PDNS_Url, PDNS_ServerId, PDNS_Token and PDNS_Ttl will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.7 Amazon Route53 DNS API
方法见:https://github.com/Neilpang/acme.sh/wiki/How-to-use-Amazon-Route53-API
export AWS_ACCESS_KEY_ID=XXXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXX
To issue a cert:
acme.sh --issue --server letsencrypt --dns dns_aws -d example.com -d www.example.com
The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.8 Linode DNS API
First you need to login to your Linode account to get your API Key. https://manager.linode.com/profile/api
Then add an API key with label ACME and copy the new key.
export LINODE_API_KEY="..."
Due to the reload time of any changes in the DNS records, we have to use the dnssleep option to wait at least 15 minutes for the changes to take effect.
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_linode --dnssleep 900 -d example.com -d www.example.com
The LINODE_API_KEY will be saved in ~/.acme.sh/account.conf and will be reused when needed.
4.9 DigitalOcean DNS API (native)
You need to obtain a read and write capable API key from your DigitalOcean account. See: https://www.digitalocean.com/help/api/
export DO_API_KEY="YOUR_DIGITALOCEAN_API_TOKEN"
Ok, let’s issue a cert now:
acme.sh --issue --server letsencrypt --dns dns_dgon -d example.com -d www.example.com
4.10 Namesilo DNS API
You’ll need to generate an API key at https://www.namesilo.com/account_api.php Optionally you may restrict the access to an IP range there.
export Namesilo_Key="xxxxxxxxxxxxxxxxxxxxxxxx"
And now you can issue certs with:
acme.sh --issue --server letsencrypt --dns dns_namesilo --dnssleep 900 -d example.com -d www.example.com
4.11 使用自定义API
If your API is not supported yet, you can write your own DNS API.
Let’s assume you want to name it ‘myapi’:
~/.acme.sh/dns_myapi.sh,dns_myapi_add() which will be called by acme.sh to add the DNS records.acme.sh --issue --server letsencrypt --dns dns_myapi -d example.com -d www.example.com
Let’s Encrypt Wildcard 免费泛域名SSL证书申请与安装还是比较简单的,目前我们可以通过脚本来申请Let’s Encrypt泛域名SSL,相信不久之后各大VPS主机控制面板就会有一键申请与安装泛域名SSL证书了。
泛域名续期也要再验证 DNS。先核对定时任务、DNS 权限和部署路径,再确认站点实际提供的是新证书。
文章出自:挖站否 https://wzfou.com/lets-encrypt-wildcard-ssl/,版权所有。本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源。
文章更新于: 2026年11月5日 上午12:33
查看评论
可是我是win的主机啊 这个。。。这个。。咋整
Windows貌似不行,只能通过在线申请的方式了。https://wzfou.com/ssl-for-free/
卡在 Found domain api file: /root/.acme.sh/dnsapi/dns_ali.sh
后来成功没?
我也用的aliyun的dns,一次成功。
成功了,我都忘了怎么解决的了,哈哈
用的阿里的DNS?看看有没有/root/.acme.sh/dnsapi/dns_ali.sh这个文件?
有的
大佬,dns.he.net这个API能怎么搞。这个有api吗。
let's的证书拿来VPS上面建站加密确实非常方便。
我现在用七牛的CDN,要加HTTPS,本来用的也是let's,但是三个月一换证书太麻烦了,后来就改成阿里云的免费证书了,一年有效期
阿里云的证书之前用的是赛门铁克,赛被封杀之后阿里换了个颁发者,叫做anywhere encryption什么的,打的旗号还是赛门铁克
Q, 发现你文章都是隔三天发布。请问博主是如何那么高产的?你写的文章深入,内容质量高。博主有什么文章创作经验分享么?博主写一篇文章要多久?
至少要一天,有些还得两三天,比较消耗时间。写文章之前主要还是靠前期资料收集与积累。
收集整理的资料放在哪?
放在邮箱里或者是印象笔记里,这样积累起来就慢慢多了。
虚拟主机用的也是这个,但是是通过https://www.sslforfree.com/ 这个方式的
虚拟主机得自己每三个更换一次证书,这个有些麻烦了。
博主有研究自动续期是怎么实现的吗?
自动续期是只生成延期证书吗?还需要手动配置nginx吗?
做google adsense比较稳定,不用动脑筋。我其他做美亚联盟
用定时任务自动更新证书,自动续期实际就是重新签发一个三个月有效期的SSL证书,自动续期的话是不用再配置Nginx,证书会自动替换掉,所以只要重启一个Nginx就好了。
谢谢,学习了,等证书到期亲自试一下
不能赚钱的博客,很难检查。Q 有什么经验可以分享给新手。谢谢!
我也一直在纠结这个事情,写个博客不赚钱的话基本上就是废掉的。目前可行的方式有做Affiliate,有尝试过吗?
做# adsense比较稳定,不用动脑筋。我其他做美亚联盟
Q你页面只有一个GG广告,能负担的起WZFou的主机和域名吗,及人力成本吗?
根本不行,一天才一两块钱,我也是放着玩,Adsense还影响网页加载速度,好多地方都打不开。
据说以后的证书时长都会慢慢改为3个月,似乎是在沃通上看到过。
付费的SSL也要三个月?
能啊,上一个alphassl某宝卖的风生水起……
我找到了发家致富的方法了。