{"id":256755,"date":"2025-10-09T13:25:16","date_gmt":"2025-10-09T05:25:16","guid":{"rendered":"https:\/\/blog.zhenglei.net\/?p=256755"},"modified":"2026-02-24T07:59:32","modified_gmt":"2026-02-23T23:59:32","slug":"asme-sh-with-dns-alias-mode","status":"publish","type":"post","link":"https:\/\/blog.zhenglei.net\/?p=256755","title":{"rendered":"asme.sh with DNS Alias Mode"},"content":{"rendered":"\n<p>\u7531\u4e8e Godaddy \u505c\u6b62\u4e86\u514d\u8d39\u7684\u652f\u6301ACME SSL  \u8bc1\u4e66\u7b7e\u53d1(DNS \u6a21\u5f0f),<\/p>\n\n\n\n<p>\u4e0d\u5f97\u4e0d\u6539\u7528 DNS Alias \u6a21\u5f0f, \u8ba9\u963f\u91cc\u4e91 \u4e3aGodaddy \u7ba1\u7406\u7684\u57df\u540d,\u4ee3\u7406\u5408\u4f5c\u7b7e\u53d1SSL\u8bc1\u4e66 <\/p>\n\n\n\n<p>\u9ed8\u8ba4\u7684\u673a\u6784\uff0cZEROSSL\uff0c\u4e00\u4e2a\u521d\u521b\u4f01\u4e1a\uff0c\u65e9\u5df2\u8d85\u8d1f\u8377\u8fd0\u8f6c\uff0c\u591a\u6570\u65f6\u95f4\u5df2\u7ecf\u65e0\u6cd5\u6b63\u5e38\u7b7e\u53d1\u4e86\u3002\u6539\u7528Google\u7684\u8bc1\u4e66\u673a\u6784\uff0c\u76f8\u5bf9\u95e8\u69db\u8f83\u9ad8\uff0c\u9700\u8981\u6709Google\u5e10\u6237\uff0c\u800c\u4e14\u56fd\u5185\u8bbf\u95ee\u53d7\u9650\uff0c\u6240\u4ee5\u7b7e\u53d1\u90fd\u4e00\u76f4\u987a\u7545\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n#\n#  Godaddy Domain:\nDOMAIN=zhenglei.net\nDNSAPI=dns_gd\n#  Aliyun Domain as Proxy:\nDOMAIN_PROXY=778065.xyz\nDNSAPI_PROXY=dns_ali\n#  Setup CNAME record mapping of _acme-challenge  between ${DOMAIN} and ${DOMAIN_PROXY}\n# _acme-challenge.zhenglei.net       CNAME==>   _acme-challenge.778065.xyz\n# _acme-challenge.blog.zhenglei.net  CNAME==>   _acme-challenge.778065.xyz\n# ...\n# nslookup -type=CNAME _acme-challenge.zhenglei.net\n# nslookup -type=CNAME _acme-challenge.blog.zhenglei.net\n# Aliyun key &amp; secret to generate acme cert\n# dnsapi=dns_ali\nAli_Key=\"Your Aliyun Key\"\nAli_Secret=\"Your Aliyun Secret\"\nexport Ali_Key=${Ali_Key}\nexport Ali_Secret=${Ali_Secret}\n# Godaddy key &amp; secret to generate acme cert\n# dnsapi=dns_gd\nGD_Key=\"Your Godaddy Key\"\nGD_Secret=\"Your Godaddy Secret\"\n#\n#  Using alias dns mode of acme.sh\nM=\" --challenge-alias ${DOMAIN_PROXY} \"\nN=\" --challenge-alias no \"\n#\n#\n# IP PROTOCOL\nIP=--listen-v6\n#\n#\n#\nDNSSLEEP=40\n# Init\nsource  \/root\/env.sh\nACME_SH=\/root\/.acme.sh\/acme.sh\n#\nfunction dsub_m () {\n  local SUB=$1\n  if &#91; ! \"A${SUB}B\" = \"AB\" ]; then\n    SUB+=\".\"\n  fi\n  local DSUB=\" -d ${SUB}${DOMAIN} --challenge-alias ${SUB}${DOMAIN_PROXY} \"\n  echo \"${DSUB}\"\n}\n#\nfunction dsub_n () {\n  local SUB=$1\n  if &#91; ! \"A${SUB}B\" = \"AB\" ]; then\n    SUB+=\".\"\n  fi\n  SUB+=\"${DOMAIN_PROXY}\"\n  local DSUB=\" -d ${SUB} --challenge-alias no \"\n  echo \"${DSUB}\"\n}\n#\n#\nDSUB_N=\" $(dsub_n ) \"\nDSUB_N+=\" -d *.${DOMAIN_PROXY}\"\n\nDSUB_M=\" $(dsub_m ) \"\nDSUB_M+=\" -d *.${DOMAIN}\"\n#\nDSUB_N+=\" $(dsub_n blog) \"\nDSUB_M+=\" $(dsub_m blog) \"\nDSUB_M+=\" $(dsub_m blog1) \"\nDSUB_M+=\" $(dsub_m blog2) \"\n#\nDSUB_N+=\" $(dsub_n gallery) \"\nDSUB_M+=\" $(dsub_m gallery) \"\nDSUB_M+=\" $(dsub_m gallery1) \"\nDSUB_M+=\" $(dsub_m gallery2) \"\n#\nDSUB_N+=\" $(dsub_n music) \"\nDSUB_M+=\" $(dsub_m music) \"\nDSUB_M+=\" $(dsub_m music1) \"\nDSUB_M+=\" $(dsub_m music2) \"\n#\nDSUB_N+=\" $(dsub_n mpd) \"\nDSUB_M+=\" $(dsub_m mpd) \"\n\nDSUB_N+=\" $(dsub_n mympd) \"\nDSUB_M+=\" $(dsub_m mympd) \"\n\nDSUB_N+=\" $(dsub_n stream) \"\nDSUB_M+=\" $(dsub_m stream) \"\n#\nDSUB_N+=\" $(dsub_n video) \"\nDSUB_M+=\" $(dsub_m video) \"\n#\n#\nP=\"\"\nP+=\" --dns ${DNSAPI_PROXY} \"\nP+=\" --dnssleep ${DNSSLEEP} \"\nP+=\" -k ec-384 \"\nP+=\" --force \"\n# P+=\" --debug \"\n# P+=\" --log \"\n\n#  Issue:\necho \"${ACME_SH} --issue  ${P} ${DSUB_M} ${DSUB_N}\"\n      ${ACME_SH} --issue  ${P} ${DSUB_M} ${DSUB_N}\n#\n\n# Install\nINST_PATH=\/opt\/local\/cert\/acme_zhenglei.net\nINST_CER=${INST_PATH}\/fullchain.cer\nINST_KEY=${INST_PATH}\/zhenglei.net.key\nOPENRESTY=\/opt\/local\/etc\/init.d\/openresty\n${ACME_SH} --install-cert -d ${DOMAIN} \\\n           --key-file ${INST_KEY} \\\n           --fullchain-file ${INST_CER} \\\n           --reloadcmd \"${OPENRESTY} stop ; ${OPENRESTY} start\"<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-embed is-type-wp-embed\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"Yp25C3z6K3\"><a href=\"https:\/\/blog.zhenglei.net\/?p=256698\">godaddy \u505c\u6b62\u652f\u6301acme.sh\u7684dns \u6a21\u5f0f<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"\u300a godaddy \u505c\u6b62\u652f\u6301acme.sh\u7684dns \u6a21\u5f0f \u300b\u2014\" src=\"https:\/\/blog.zhenglei.net\/?p=256698&#038;embed=true#?secret=M8vMdw5Ejt#?secret=Yp25C3z6K3\" data-secret=\"Yp25C3z6K3\" width=\"584\" height=\"329\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><a href=\"https:\/\/github.com\/acmesh-official\/acme.sh\/wiki\/DNS-alias-mode\">https:\/\/github.com\/acmesh-official\/acme.sh\/wiki\/DNS-alias-mode<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e Godaddy \u505c\u6b62\u4e86\u514d\u8d39\u7684\u652f\u6301ACME SSL \u8bc1\u4e66\u7b7e\u53d1(DNS \u6a21\u5f0f) &hellip; <a href=\"https:\/\/blog.zhenglei.net\/?p=256755\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[435,366,25,67,177],"class_list":["post-256755","post","type-post","status-publish","format-standard","hentry","category-software-download","tag-acme","tag-aliyun","tag-dns","tag-godaddy","tag-ssl"],"_links":{"self":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/256755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=256755"}],"version-history":[{"count":5,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/256755\/revisions"}],"predecessor-version":[{"id":256763,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/256755\/revisions\/256763"}],"wp:attachment":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=256755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=256755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=256755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}