{"id":87,"date":"2026-01-06T17:30:48","date_gmt":"2026-01-06T09:30:48","guid":{"rendered":"https:\/\/jjm6.com\/?p=87"},"modified":"2026-01-06T18:22:24","modified_gmt":"2026-01-06T10:22:24","slug":"acmecloudflare%e7%94%9f%e6%88%90%e5%85%8d%e8%b4%b9%e8%af%81%e4%b9%a6%ef%bc%88%e8%87%aa%e5%8a%a8%e7%bb%ad%e6%9c%9f%ef%bc%89","status":"publish","type":"post","link":"https:\/\/jjm6.com\/index.php\/2026\/01\/06\/acmecloudflare%e7%94%9f%e6%88%90%e5%85%8d%e8%b4%b9%e8%af%81%e4%b9%a6%ef%bc%88%e8%87%aa%e5%8a%a8%e7%bb%ad%e6%9c%9f%ef%bc%89\/","title":{"rendered":"<a href=\"https:\/\/www.cnblogs.com\/blogforeverything\/p\/18426804\">acme+cloudflare\u751f\u6210\u514d\u8d39\u8bc1\u4e66\uff08\u81ea\u52a8\u7eed\u671f\uff09<\/a>"},"content":{"rendered":"\n<h2 id=\"acme-dnsapi\">acme DNSapi<\/h2>\n\n\n\n<p>acme DNSapi\u7684\u4f5c\u7528\u662f\u5728\u7533\u8bf7\u8bc1\u4e66\u65f6\u4f7f\u7528dns\u6821\u9a8c\uff0cacme\u53ef\u4ee5\u901a\u8fc7dnsapi\u5728\u5bf9\u5e94\u7684dns\u7ba1\u7406\u5e73\u53f0\u63d0\u4ea4\u5bf9\u5e94\u7684dns\u8bb0\u5f55\u3002\u73a9\u8fc7\u8bc1\u4e66\u7684\u670b\u53cb\u90fd\u77e5\u9053\uff0c\u8bc1\u4e66\u7533\u8bf7\u65f6\u6709\u4e09\u79cd\u9a8c\u8bc1\u65b9\u5f0f<\/p>\n\n\n\n<ul>\n<li>\u90ae\u7bb1\u9a8c\u8bc1\uff1a\u9700\u8981\u90ae\u7bb1\u4e0e\u57df\u540d\u7ed1\u5b9a\uff08\u7ec6\u8282\u8981\u6c42\u6211\u6ca1\u8bd5\u8fc7\uff09<\/li>\n\n\n\n<li>\u6587\u4ef6\u9a8c\u8bc1\uff1a\u6587\u4ef6\u9a8c\u8bc1\u65f6\u8bc1\u4e66\u7ba1\u7406\u65b9\u4f1a\u8981\u6c42\u4f60\u5728\u670d\u52a1\u5668\u7684\u6307\u5b9a\u8def\u5f84\u4e0a\u653e\u4e00\u4e2a\u6307\u5b9a\u6587\u4ef6\uff08\u5185\u5bb9\u4e5f\u662f\u4ed6\u4eec\u5b9a\uff09\uff0c\u7136\u540e\u5f00\u653e80\u7aef\u53e3\uff0c\u4ed6\u4eec\u4f1a\u53bb\u4e0b\u8f7d\u8fd9\u4e2a\u6587\u4ef6\u4ece\u800c\u9a8c\u8bc1\u4f60\u7684\u8eab\u4efd\u3002\u7533\u8bf7\u8bc1\u4e66\u65f6\u4f60\u9700\u8981\u53bb\u4f60\u7684\u670d\u52a1\u5668\u4e0a\u64cd\u4f5c\uff0c\u8fd8\u8981\u5f00\u653e\u6307\u5b9a\u7aef\u53e3<\/li>\n\n\n\n<li>DNS\u9a8c\u8bc1\uff1aDNS\u9a8c\u8bc1\u53ea\u9700\u8981\u4f60\u5728dns\u8bb0\u5f55\u4e0a\u6dfb\u52a0\u4e00\u6761TXT\u8bb0\u5f55\u5c31\u53ef\u4ee5<\/li>\n<\/ul>\n\n\n\n<p>\u6211\u4eec\u8fd9\u91cc\u7528\u5230\u7684\u5c31\u662fDNS\u9a8c\u8bc1\uff0cDNS\u9a8c\u8bc1\u867d\u7136\u65b9\u4fbf\uff0c\u4f46\u662f\u6bcf\u6b21\u7533\u8bf7\u90fd\u9700\u8981\u6dfb\u52a0\u4e00\u6761DNS\u8bb0\u5f55\uff08\u7533\u8bf7\u5b8c\u6210\u540e\u53ef\u4ee5\u5220\u9664\uff0cacme\u597d\u50cf\u81ea\u52a8\u5e2e\u5fd9\u5220\u9664\u4e86\uff09\uff0c\u5982\u679c\u8981\u5b9e\u73b0\u81ea\u52a8\u5316\uff0cacme\u9700\u8981\u6709\u6743\u9650\u5411dns\u8bb0\u5f55\u65b9\u63d0\u4ea4\u8bb0\u5f55\u3002<\/p>\n\n\n\n<h2 id=\"cloudflare-dnsapi\">cloudflare DNSapi<\/h2>\n\n\n\n<p><a href=\"https:\/\/github.com\/acmesh-official\/acme.sh\/wiki\/dnsapi#using-the-new-cloudflare-api-token-you-will-get-this-after-normal-login-and--scroll-down-on-dashboard-and-copy-credentials\" target=\"_blank\" rel=\"noreferrer noopener\">acme dns api doce<\/a><\/p>\n\n\n\n<p>\u6839\u636e\u4e0a\u9762\u7684\u6587\u6863\u53ef\u4ee5\u770b\u5230cloudflare dns api \u6709\u4e24\u79cd\u65b9\u5f0f\u83b7\u53d6<\/p>\n\n\n\n<ul>\n<li>\u751f\u6210cloudflare\u7684\u5168\u5c40token\uff08\u5168\u5c40token\u62e5\u6709cloudflare\u7684\u6240\u6709\u6743\u9650\uff0c\u5927\u90e8\u5206\u662facme\u7528\u4e0d\u5230\u7684\uff09<\/li>\n\n\n\n<li>\u751f\u6210cloudflare\u7684DNS\u6743\u9650token\uff08\u63a8\u8350\uff0c\u591facme\u7528\u7684\u4e86\uff09<\/li>\n<\/ul>\n\n\n\n<h3 id=\"\u751f\u6210cloudflare\u7684dns\u6743\u9650token\">\u751f\u6210cloudflare\u7684DNS\u6743\u9650token<\/h3>\n\n\n\n<p>\u5148\u6765cloudflare\u7684Api<a href=\"https:\/\/dash.cloudflare.com\/profile\/api-tokens\" target=\"_blank\" rel=\"noreferrer noopener\">\u7533\u8bf7\u9875\u9762<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/XknlUhgI4GubSZ3.png\" alt=\"image-20240923085901516\"\/><\/figure>\n\n\n\n<p>\u70b9\u51fb\u8fd9\u91cc\u7684\u521b\u5efa\u4ee4\u724c<\/p>\n\n\n\n<p>\u9009\u62e9\u7f16\u8f91\u533a\u57dfDNS \u8fd9\u4e2a\u6a21\u677f\uff08\u4e00\u822c\u6765\u8bf4\u662f\u7b2c\u4e00\u4e2a\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/ktzyeIHSbfJd9mF.png\" alt=\"image-20240923085941855\"\/><\/figure>\n\n\n\n<p>\u6309\u7167\u4e0b\u9762\u7684\u5185\u5bb9\u586b\u5199<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/NcAqGh94ifVkIaT.png\" alt=\"image-20240923090119372\"\/><\/figure>\n\n\n\n<p>\u6743\u9650\u9009&nbsp;<code>\u533a\u57df<\/code>&nbsp;-&gt;&nbsp;<code>DNS<\/code>&nbsp;-&gt;&nbsp;<code>\u7f16\u8f91<\/code><\/p>\n\n\n\n<p>\u533a\u57df\u8d44\u6e90&nbsp;<code>\u5305\u62ec<\/code>&nbsp;-&gt;&nbsp;<code>\u7279\u5b9a\u533a\u57df<\/code>&nbsp;-&gt; \u5728\u4e0b\u62c9\u5217\u8868\u91cc\u9009\u4f60\u7684\u57df\u540d\uff08\u4f60\u4e5f\u53ef\u4ee5\u5728\u7b2c\u4e8c\u4e2a\u6846\u91cc\u9762\u9009\u62e9<code>\u6240\u6709\u533a\u57df<\/code>\uff09<\/p>\n\n\n\n<p>\u5269\u4e0b\u90fd\u4e0d\u53d8\uff0c\u70b9\u7ee7\u7eed\uff0c\u8df3\u8f6c\u5230\u8fd9\u4e2a\u9875\u9762<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/HnLjAY7sqb95zar.png\" alt=\"image-20240923090358443\"\/><\/figure>\n\n\n\n<p>\u70b9\u51fb\u751f\u6210\u4ee4\u724c\uff0c\u5c31\u4f1a\u4ea7\u751f\u4e00\u4e2a\u4ee4\u724c\uff0c\u4ee4\u724c\u751f\u6210\u540e\u7b2c\u4e00\u65f6\u95f4\u8bb0\u5f55\u4e0b\u6765\uff0c\u8fd9\u4e2a\u4ee4\u724c\u53ea\u663e\u793a\u4e00\u6b21\uff0c\u5237\u65b0\u9875\u9762\u540e\u5c31\u770b\u4e0d\u5230\u4e86<\/p>\n\n\n\n<h3 id=\"\u83b7\u53d6cloudflare\u7684\u7528\u6237\u4fe1\u606f\">\u83b7\u53d6cloudflare\u7684\u7528\u6237\u4fe1\u606f<\/h3>\n\n\n\n<p>\u70b9\u5230cloudflare\u4e2d\u5bf9\u5e94\u7684\u7f51\u9875\u7ba1\u7406\u9875\u9762\uff0c\u5728api\u7684\u5730\u65b9\u53ef\u4ee5\u770b\u5230\u4e24\u4e2aID<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/vRAkuQhniUmLYg5.png\" alt=\"image-20240923090719587\"\/><\/figure>\n\n\n\n<p>\u73b0\u5728\u6211\u4eec\u6709\u4e09\u4e2a\u4fe1\u606f<\/p>\n\n\n\n<ul>\n<li>\u4e0a\u9762\u751f\u6210\u7684\u4e00\u4e2a\u7ba1\u7406DNS\u7684TOKEN<\/li>\n\n\n\n<li>\u8fd9\u91cc\u7684\u533a\u57dfID<\/li>\n\n\n\n<li>\u8fd9\u91cc\u7684\u8d26\u6237ID<\/li>\n<\/ul>\n\n\n\n<h3 id=\"\u5728\u5bf9\u5e94\u670d\u52a1\u5668\u4e0a\u751f\u6210\u8bc1\u4e66\">\u5728\u5bf9\u5e94\u670d\u52a1\u5668\u4e0a\u751f\u6210\u8bc1\u4e66<\/h3>\n\n\n\n<p><strong>\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export CF_Token=\"\u586bDNS token\"\nexport CF_Zone_ID=\"\u586b\u533a\u57dfID\"\nexport CF_Account_ID=\"\u586b\u8d26\u6237ID\"<\/code><\/pre>\n\n\n\n<p><strong>\u5b89\u88c5acme<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update -y          #\u66f4\u65b0\u7cfb\u7edf  \napt install -y curl    #\u5b89\u88c5\ncurl apt install -y socat    #\u5b89\u88c5socat  \ncurl https:\/\/get.acme.sh | sh<\/code><\/pre>\n\n\n\n<p><strong>\u751f\u6210\u8bc1\u4e66<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>acme.sh --issue --dns dns_cf -d test.fun -d \"*.test.fun\"<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u8bf4\u627e\u4e0d\u5230acme.sh\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>~\/.acme.sh\/acme.sh --issue --dns dns_cf -d test.fun -d \"*.test.fun\"<\/code><\/pre>\n\n\n\n<p>\u7b49\u4ed6\u8dd1\u7801,\u4f1a\u544a\u8bc9\u4f60\u8bc1\u4e66\u7684\u4f4d\u7f6e<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/grt8H5Txn6kC9NG.png\" alt=\"image-20240923092443069\"\/><\/figure>\n\n\n\n<p>\u5173\u952e\u662f\u4e0a\u9762\u4e24\u884c<code>your cert<\/code>,&nbsp;<code>your cert key<\/code><\/p>\n\n\n\n<p>\u4e0a\u9762\u751f\u6210\u7684\u8bc1\u4e66\u662f\u00a0<code>*.test.fun<\/code>\u00a0\u7684\u8bc1\u4e66\uff0c\u6240\u6709\u7684\u4ee5<code>test.fun<\/code>\u7ed3\u5c3e\u7684\u57df\u540d\u90fd\u53ef\u4ee5\u7528\u8fd9\u4e2a\u8bc1\u4e66<\/p>\n\n\n\n<p>\u5b89\u88c5\u8bc1\u4e66<\/p>\n\n\n\n<p>~\/.acme.sh\/acme.sh &#8211;install-cert -d testfun.com &#8211;ecc &#8211;key-file \/root\/testfun.com\/server.key &#8211;fullchain-file \/root\/testfun.com\/server.crt<\/p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>\u63a8\u8350\u7684\u4f7f\u7528\u65b9\u6848\uff1a \u56e0\u4e3aacme\u6b63\u5e382\u4e2a\u6708\u4f1a\u81ea\u52a8\u66f4\u65b0\u4e00\u4e0b\u8bc1\u4e66\uff0c\u6240\u4ee5\u6211\u4e0d\u63a8\u8350\u4f60\u628a\u8bc1\u4e66\u79fb\u52a8\u5230\u522b\u7684\u4f4d\u7f6e\uff0c\u56e0\u4e3aacme\u4e0b\u6b21\u751f\u6210\u7684\u65f6\u5019\u8fd8\u4f1a\u653e\u5728\u8fd9\u4e2a\u4f4d\u7f6e\uff0c\u8981\u4e48\u4f60\u6307\u5b9aacme\u7684\u8bc1\u4e66\u751f\u6210\u8def\u5f84\uff0c\u53ef\u4ee5\u7528<code>acme.sh --help<\/code>&nbsp;\u67e5\u770b\u600e\u4e48\u6307\u5b9a\u8def\u5f84\u3002\u6211\u4f7f\u7528\u7684\u65b9\u6cd5\u662f\uff08\u6709\u4e24\u4e2a\uff09<\/p>\n\n\n\n<ul>\n<li>\u76f4\u63a5\u4f7f\u7528\u8fd9\u4e2a\u8def\u5f84<\/li>\n\n\n\n<li>\u901a\u8fc7\u8f6f\u8fde\u63a5\u628a\u8bc1\u4e66\u94fe\u63a5\u8fc7\u53bb\u6bd4\u5982\u6211\u8981\u628a\u8bc1\u4e66\u653e\u5728\/etc\/nginx\/ssl \u91cc\u9762 \u5206\u522b\u547d\u540d\u4e3a<code>cert.crt<\/code>&nbsp;<code>priv.key<\/code>\u6211\u53ef\u4ee5\u8fd9\u6837\u505a<code>cd \/etc\/naginx\/sslln -s \/home\/ivhu\/.acme.sh\/\u8bc1\u4e66\u8def\u5f84.cer cert.crtln -s \/home\/ivhu\/acme.sh\/\u8bc1\u4e66\u79c1\u94a5.key priv.key<\/code><\/li>\n<\/ul>\n<\/blockquote>\n\n\n\n<p>\u8bc1\u4e66\u751f\u6210\u540e\u4e00\u822c\u4f1a\u65b0\u5efa\u4e00\u4e2acron \u7684\u5b9a\u65f6\u8ba4\u4e3a\u7528\u6765\u7ef4\u62a4\u8bc1\u4e66\u4fdd\u8bc1\u671f<\/p>\n\n\n\n<p>\u53ef\u4ee5\u901a\u8fc7&nbsp;<code>crontab -e<\/code>\u547d\u4ee4\u67e5\u770b\uff0c\u6211\u7684\u7ed3\u679c\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/s2.loli.net\/2024\/09\/23\/Cq8gBjoKfVGNUAx.png\" alt=\"image-20240923091717497\"\/><\/figure>\n\n\n\n<p>\u610f\u601d\u662f\u6bcf\u5929\u51cc\u66683\uff1a28\u4f1a\u68c0\u67e5\u4e00\u4e0b\u8bc1\u4e66<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u7684\u8bc1\u4e66\u662f\u7ed9<code>nginx<\/code>\u7528\u7684\u53ef\u4ee5\u5728<code>root<\/code>\u7528\u6237\u4e0b\u8fd0\u884c<code>crontab -e<\/code>&nbsp;\u7f16\u8f91root\u7528\u6237\u7684cron\u81ea\u52a8\u5316\u547d\u4ee4<\/p>\n\n\n\n<p>\u6dfb\u52a0\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>0 4 * * * systemctl reload nginx<\/code><\/pre>\n\n\n\n<p>\u8868\u793a\u6bcf\u59294\uff1a00 \u91cd\u542fnginx \uff0c\u56e0\u4e3anginx\u7684\u8bc1\u4e66\u9700\u8981\u91cd\u542f\u4e4b\u540e\u624d\u80fd\u91cd\u8f7d<\/p>\n","protected":false},"excerpt":{"rendered":"<p>acme DNSapi acme DNSapi\u7684\u4f5c\u7528\u662f\u5728\u7533\u8bf7\u8bc1\u4e66\u65f6\u4f7f\u7528dns\u6821\u9a8c\uff0cacme\u53ef\u4ee5\u901a\u8fc7dnsapi &hellip; <a href=\"https:\/\/jjm6.com\/index.php\/2026\/01\/06\/acmecloudflare%e7%94%9f%e6%88%90%e5%85%8d%e8%b4%b9%e8%af%81%e4%b9%a6%ef%bc%88%e8%87%aa%e5%8a%a8%e7%bb%ad%e6%9c%9f%ef%bc%89\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c<a href=\"https:\/\/www.cnblogs.com\/blogforeverything\/p\/18426804\">acme+cloudflare\u751f\u6210\u514d\u8d39\u8bc1\u4e66\uff08\u81ea\u52a8\u7eed\u671f\uff09<\/a>\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/posts\/87"}],"collection":[{"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":4,"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":92,"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/posts\/87\/revisions\/92"}],"wp:attachment":[{"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jjm6.com\/index.php\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}