{"id":6,"date":"2025-07-28T17:58:47","date_gmt":"2025-07-28T09:58:47","guid":{"rendered":"http:\/\/chutianshun.com\/?p=6"},"modified":"2025-07-29T14:26:28","modified_gmt":"2025-07-29T06:26:28","slug":"%e4%bd%bf%e7%94%a8-acme-sh-cloudflare-%e7%94%b3%e8%af%b7%e9%80%9a%e9%85%8d%e7%ac%a6-ssl-%e8%af%81%e4%b9%a6%e5%b9%b6%e9%83%a8%e7%bd%b2%e5%88%b0%e5%ae%9d%e5%a1%94%e9%9d%a2%e6%9d%bf%ef%bc%88%e6%94%af","status":"publish","type":"post","link":"https:\/\/chutianshun.com\/index.php\/2025\/07\/28\/%e4%bd%bf%e7%94%a8-acme-sh-cloudflare-%e7%94%b3%e8%af%b7%e9%80%9a%e9%85%8d%e7%ac%a6-ssl-%e8%af%81%e4%b9%a6%e5%b9%b6%e9%83%a8%e7%bd%b2%e5%88%b0%e5%ae%9d%e5%a1%94%e9%9d%a2%e6%9d%bf%ef%bc%88%e6%94%af\/","title":{"rendered":"\u4f7f\u7528 acme.sh + Cloudflare \u7533\u8bf7\u901a\u914d\u7b26 SSL \u8bc1\u4e66\u5e76\u90e8\u7f72\u5230\u5b9d\u5854\u9762\u677f\uff08\u652f\u6301\u81ea\u52a8\u7eed\u671f\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"> \u573a\u666f\u8bf4\u660e<\/h2>\n\n\n\n<p>\u9002\u7528\u76ee\u6807\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f60\u5e0c\u671b\u4e3a\u4e3b\u57df\u540d <code>example.com<\/code> \u548c\u6240\u6709\u4e8c\u7ea7\u57df\u540d <code>*.example.com<\/code> \u914d\u7f6e HTTPS\u3002<\/li>\n\n\n\n<li>\u4f60\u4f7f\u7528\u7684\u662f\u5b9d\u5854\u9762\u677f\u7ba1\u7406\u7f51\u7ad9\uff0c\u4f7f\u7528\u7684\u662f nginx\u3002<\/li>\n\n\n\n<li>\u4f60\u5e0c\u671b\u5b9e\u73b0\u81ea\u52a8\u7eed\u671f\u3001\u65e0\u9700\u4eba\u5de5\u5e72\u9884\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\"> \u2705\u7b2c\u4e00\u6b65\uff1a\u914d\u7f6e Cloudflare API \u4ee4\u724c<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u767b\u5f55 <a href=\"http:\/\/www.cloudflare.com\/zh-cn\" data-type=\"link\" data-id=\"www.cloudflare.com\/zh-cn\">Cloudflare<\/a><\/li>\n\n\n\n<li>\u70b9\u51fb\u53f3\u4e0a\u89d2-&gt;\u914d\u7f6e\u6587\u4ef6-&gt;api\u4ee4\u724c<\/li>\n\n\n\n<li>\u521b\u5efa API \u4ee4\u724c\uff0c\u5982\u4e0b\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">\u7f16\u8f91\u533a\u57dfdns-&gt;\u533a\u57df\u8d44\u6e90\uff08\u8bbe\u7f6e\u8d26\u6237\u7684\u6240\u6709\u533a\u57df\uff0c\u53f3\u4fa7\u9009\u62e9\u90ae\u7bb1\uff09<br>-&gt;\u5ba2\u6237\u7aefip\u8fd0\u7b97\u7b26\u9009\u62e9\uff1a\u5728\uff0cip\u8bbe\u7f6e\u4e3a\u670d\u52a1\u5668ip<code><br><\/code><\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>\u521b\u5efa\u6210\u529f\u540e\uff0c\u590d\u5236\u4f60\u7684 Token\u3002<\/li>\n\n\n\n<li>\u5c06 Token \u5199\u5165\u670d\u52a1\u5668\u73af\u5883\u53d8\u91cf\uff0c\u5e76\u6301\u4e45\u4fdd\u5b58\uff1a<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-preformatted\">echo 'export CF_Token=\"\u8fd9\u91cc\u5199token\"' &gt;&gt; ~\/.bashrc<br>source ~\/.bashrc<code><br><\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u7b2c\u4e8c\u6b65\uff1a\u5b89\u88c5 acme.sh\uff08\u5982\u679c\u672a\u5b89\u88c5\uff09<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">curl https:\/\/get.acme.sh | sh -s email=my@example.com<br><br>\u7f51\u7edc\u95ee\u9898\u53c2\u8003\uff1ahttps:\/\/github.com\/acmesh-official\/acme.sh\/wiki\/Install-in-China<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u7b2c\u4e09\u6b65\uff1a\u4f7f\u7528 DNS \u9a8c\u8bc1\u65b9\u5f0f\u7533\u8bf7\u901a\u914d\u7b26\u8bc1\u4e66<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">acme.sh --issue --dns dns_cf -d example.com -d '*.example.com'<\/pre>\n\n\n\n<p>\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>--dns dns_cf<\/code> \u8868\u793a\u4f7f\u7528 Cloudflare DNS \u9a8c\u8bc1\u3002<\/li>\n\n\n\n<li><code>-d example.com<\/code> + <code>-d '*.example.com'<\/code> \u53ef\u4ee5\u540c\u65f6\u8986\u76d6\u4e3b\u57df\u540d\u548c\u6240\u6709\u4e8c\u7ea7\u57df\u540d\u3002<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u7b2c\u56db\u6b65\uff1a\u5b89\u88c5\u8bc1\u4e66\u5230\u5b9d\u5854\u9762\u677f\u4f7f\u7528\u7684\u8def\u5f84<\/h2>\n\n\n\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5c06\u8bc1\u4e66\u90e8\u7f72\u5230\u5b9d\u5854\u6307\u5b9a\u8def\u5f84\uff08Nginx \u9ed8\u8ba4\u4f7f\u7528\uff09\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">acme.sh --install-cert -d example.com \\<br>--key-file       \/www\/server\/panel\/vhost\/cert\/example.com\/privkey.pem \\<br>--fullchain-file \/www\/server\/panel\/vhost\/cert\/example.com\/fullchain.pem \\<br>--reloadcmd      \"nginx -s reload\"<code><br><\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u8bf4\u660e\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6b64\u8def\u5f84\u662f\u5b9d\u5854\u9762\u677f\u81ea\u52a8\u8bfb\u53d6\u8bc1\u4e66\u7684\u8def\u5f84\u3002<\/li>\n\n\n\n<li>example.com\u5bf9\u5e94\u81ea\u5df1\u7684\u57df\u540d<\/li>\n\n\n\n<li>\u6267\u884c\u540e\u4f1a\u7acb\u5373 reload nginx\uff0c\u66ff\u6362\u5f53\u524d\u8bc1\u4e66\u3002<\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u7b2c\u4e94\u6b65\uff1a\u5728\u5b9d\u5854\u9762\u677f\u7ad9\u70b9\u7ed1\u5b9a\u57df\u540d<\/h2>\n\n\n\n<p>\u5728\u5b9d\u5854\u9762\u677f\u5bf9\u5e94\u7ad9\u70b9\u7ed1\u5b9a\u6240\u6709\u9700\u8981\u7684\u57df\u540d\uff0c\u4f8b\u5982\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">example.com<br>www.example.com<br>api.example.com<br>cdn.example.com<code><br><\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528\u540c\u4e00\u4e2a\u7ad9\u70b9\u7ed1\u5b9a\u591a\u4e2a\u57df\u540d\uff0c<strong>\u90fd\u4f1a\u5339\u914d\u8bc1\u4e66 <code>*.example.com<\/code><\/strong>\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u2705 \u7b2c\u516d\u6b65\uff1a\u81ea\u52a8\u7eed\u671f\u673a\u5236<\/h2>\n\n\n\n<p>acme.sh \u4f1a\u81ea\u52a8\u7eed\u671f\uff0c\u65e0\u9700\u4eba\u5de5\u5e72\u9884\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9ed8\u8ba4\u6bcf\u5929\u8fd0\u884c cron job \u68c0\u67e5\u662f\u5426\u9700\u8981\u7eed\u671f\u3002<\/li>\n\n\n\n<li>\u5982\u679c\u7eed\u671f\u6210\u529f\uff0c\u4f1a\u81ea\u52a8\u6267\u884c\u4f60\u4e4b\u524d\u7684 <code>--install-cert<\/code> \u811a\u672c\uff0c\u5305\u62ec reload nginx\u3002<\/li>\n\n\n\n<li>\u53ea\u8981 Cloudflare Token \u6ca1\u5931\u6548\u3001\u57df\u540d DNS \u6ca1\u53d8\u66f4\uff0c\u7eed\u671f\u5c31\u4f1a\u6301\u7eed\u6b63\u5e38\u5de5\u4f5c\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4f60\u53ef\u4ee5\u624b\u52a8\u6d4b\u8bd5\u7eed\u671f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">acme.sh --renew -d example.com --force<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\ud83d\udd01 \u53ef\u9009\uff1a\u67e5\u770b\u8bc1\u4e66\u8def\u5f84<\/h2>\n\n\n\n<p>\u8bc1\u4e66\u6587\u4ef6\u4e00\u822c\u4f4d\u4e8e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/root\/.acme.sh\/example.com\/<code><br><\/code><\/pre>\n\n\n\n<p>\u5b89\u88c5\u540e\u7684\u5b9d\u5854\u4f7f\u7528\u8def\u5f84\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/www\/server\/panel\/vhost\/cert\/example.com\/<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u573a\u666f\u8bf4\u660e \u9002\u7528\u76ee\u6807\uff1a \u2705\u7b2c\u4e00\u6b65\uff1a\u914d\u7f6e Cloudflare API \u4ee4\u724c \u7f16\u8f91\u533a\u57dfdns-&gt;\u533a\u57df\u8d44\u6e90\uff08\u8bbe [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/posts\/6","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/comments?post=6"}],"version-history":[{"count":2,"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/posts\/6\/revisions"}],"predecessor-version":[{"id":9,"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/posts\/6\/revisions\/9"}],"wp:attachment":[{"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/media?parent=6"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/categories?post=6"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chutianshun.com\/index.php\/wp-json\/wp\/v2\/tags?post=6"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}