apply_cert_api
创建 Let's Encrypt(或其他 ACME CA)证书申请订单。支持三种验证方式。
- 路由:
POST /acme - action:
apply_cert_api
输入参数
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| action | 是 | String | 固定值 apply_cert_api |
| id | 是 | Integer | 关联网站 ID |
| domains | 是 | String | JSON 数组,要申请的域名列表 ["example.com","www.example.com"] |
| auth_type | 是 | String | 验证方式:http(文件)、tls(TLS)、dns(DNS) |
| auth_to | 是 | String | 验证路径。HTTP/TLS 传网站目录;DNS 验证传 dns |
| auto_wildcard | 否 | String | "1" 自动申请泛域名 *.example.com |
| ca | 否 | String | CA 标识,默认 Let's Encrypt |
DNS 验证
auth_type=dns, auth_to=dns 时仅创建订单。需再用 apply_dns_auth 完成 DNS TXT 记录创建和验证。
输出参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| status | String | pending 订单待验证 |
| index | String | 订单索引 ID,后续操作需要 |
| domains | Array | 申请的域名列表 |
| authorizations | Array | Let's Encrypt 授权 URL 列表 |
| expires | Integer | 订单过期时间戳 |
| create_time | Integer | 创建时间戳 |
示例
请求(DNS 验证)
POST /acme HTTP/1.1
Host: 192.168.168.213:8888
Content-Type: application/x-www-form-urlencoded
action=apply_cert_api&id=1&domains=["dnstest.cc"]&auth_type=dns&auth_to=dns
响应
{
"status": "pending",
"index": "a7a0472c4a5061ec83450119b874a5d3",
"domains": ["dnstest.cc"],
"auth_type": "dns",
"expires": 1780111135,
"create_time": 1779506335,
"authorizations": ["https://acme-v02.api.letsencrypt.org/acme/authz/..."]
}
相关接口
- apply_dns_auth — 完成 DNS 验证并签发
- SetCertToSite — 部署证书到网站