{"id":574,"date":"2025-03-07T22:47:10","date_gmt":"2025-03-07T14:47:10","guid":{"rendered":"https:\/\/blog.guguan.us.kg\/?p=574"},"modified":"2025-03-09T09:12:37","modified_gmt":"2025-03-09T01:12:37","slug":"certbot-docker-%e9%95%9c%e5%83%8f%e4%bd%bf%e7%94%a8%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.guguan.us.kg\/?p=574","title":{"rendered":"Certbot Docker \u955c\u50cf\u4f7f\u7528\u65b9\u6cd5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u5b98\u65b9Docker\u955c\u50cf\uff1a<a href=\"https:\/\/hub.docker.com\/r\/certbot\/certbot\">certbot\/certbot &#8211; Docker Image | Docker Hub<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u539f\u7406\uff1a\u5c06\u7f51\u9875\u6839\u76ee\u5f55\u6302\u8f7d\u5230 Certbot \u7684\u5bb9\u5668\u5185\u90e8<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u793a\u4f8b\uff08www.example.com\u662f\u4f60\u7684\u57df\u540d\u3001your.email@example.com\u662f\u4f60\u7684\u90ae\u7bb1\uff09\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Nginx \u5bb9\u5668\u542f\u52a8\u547d\u4ee4\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -it --rm --name nginx \\\n-v \"\/etc\/nginx:\/etc\/nginx\" \\\n-v \"\/etc\/letsencrypt:\/etc\/letsencrypt\" \\\n-v \"\/usr\/share\/nginx\/html:\/usr\/share\/nginx\/html\" \\\nnginx<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Certbot \u7b2c\u4e00\u6b21\u83b7\u53d6\u8bc1\u4e66\uff1a<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\uff08-d \u53c2\u6570\u53ef\u4ee5\u662f\u591a\u4e2a\u57df\u540d\uff1aexisting.com,example.com,newdomain.com\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -it --rm --name certbot \\\n-v \"\/etc\/letsencrypt:\/etc\/letsencrypt\" \\\n-v \"\/var\/lib\/letsencrypt:\/var\/lib\/letsencrypt\" \\\n-v \"\/usr\/share\/nginx\/html:\/usr\/share\/nginx\/html\" \\\ncertbot\/certbot certonly --webroot \\\n-w \/usr\/share\/nginx\/html \\\n-d www.example.com \\\n--email your.email@example.com \\\n--agree-tos --no-eff-email<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u53c2\u6570\u8bf4\u660e<\/strong>\uff1a\n<ul class=\"wp-block-list\">\n<li><code>certonly --webroot<\/code>\uff1a\u4f7f\u7528 Webroot \u63d2\u4ef6\u9a8c\u8bc1\u57df\u540d\u5e76\u751f\u6210\u8bc1\u4e66\u3002<\/li>\n\n\n\n<li><code>-d<\/code>\uff1a\u6307\u5b9a\u57df\u540d\uff08\u66ff\u6362\u4e3a\u4f60\u7684\u5b9e\u9645\u57df\u540d\uff09\u3002<\/li>\n\n\n\n<li><code>--email<\/code>\uff1a\u8bbe\u7f6e\u8054\u7cfb\u90ae\u7bb1\u3002<\/li>\n\n\n\n<li><code>--agree-tos<\/code>\uff1a\u540c\u610f Let&#8217;s Encrypt \u670d\u52a1\u6761\u6b3e\u3002<\/li>\n\n\n\n<li><code>--no-eff-email<\/code>\uff1a\u4e0d\u8ba2\u9605 EFF \u90ae\u4ef6\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u7ed3\u679c<\/strong>\uff1a\u8bc1\u4e66\u4f1a\u5b58\u50a8\u5728\u00a0<code>\/etc\/letsencrypt\/live\/example.com\/<\/code>\u00a0\u76ee\u5f55\u4e0b\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Certbot \u7eed\u7b7e\u8bc1\u4e66\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker run -it --rm --name certbot \\\n-v \"\/etc\/letsencrypt:\/etc\/letsencrypt\" \\\n-v \"\/var\/lib\/letsencrypt:\/var\/lib\/letsencrypt\" \\\n-v \"\/usr\/share\/nginx\/html:\/usr\/share\/nginx\/html\" \\\ncertbot\/certbot renew<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7528Docker\u90e8\u7f72Nginx\u65f6\u81ea\u52a8\u83b7\u53d6TLS\u8bc1\u4e66\u7684\u65b9\u6cd5<\/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":[84,15,85,37],"class_list":["post-574","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-certbot","tag-docker","tag-https","tag-nginx"],"_links":{"self":[{"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=\/wp\/v2\/posts\/574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=574"}],"version-history":[{"count":3,"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions"}],"predecessor-version":[{"id":584,"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=\/wp\/v2\/posts\/574\/revisions\/584"}],"wp:attachment":[{"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=574"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=574"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.guguan.us.kg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}