{"id":97377,"date":"2024-06-10T19:04:11","date_gmt":"2024-06-10T11:04:11","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=97377"},"modified":"2024-06-10T19:04:11","modified_gmt":"2024-06-10T11:04:11","slug":"lets-encrypt-https","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/lets-encrypt-https.html","title":{"rendered":"\u600e\u6837\u7533\u8bf7\u901a\u914d\u7b26HTTPS\u8bc1\u4e66"},"content":{"rendered":"
Let's Encrypt \u53d1\u5e03\u7684 ACME v2 \u73b0\u5df2\u6b63\u5f0f\u652f\u6301\u901a\u914d\u7b26\u8bc1\u4e66\uff0c\u63a5\u4e0b\u6765\u5c06\u4e3a\u5927\u5bb6\u4ecb\u7ecd\u600e\u6837\u7533\u8bf7\uff0cLet's go.<\/p>\n
\u6ce8 \u672c\u6559\u7a0b\u662f\u5728centos 7\u4e0b\u64cd\u4f5c\u7684\uff0c\u5176\u4ed6Linux\u7cfb\u7edf\u5927\u540c\u5c0f\u5f02\u3002<\/p>\n
# \u4e0b\u8f7d<\/span>\r\nwget<\/span> https:\/\/dl.eff.org\/certbot-auto\r\n\r\n# \u8bbe\u4e3a\u53ef\u6267\u884c\u6743\u9650<\/span>\r\nchmod a+x certbot-auto\r\n<\/pre>\n2.\u5f00\u59cb\u7533\u8bf7\u8bc1\u4e66<\/strong><\/span><\/div>\n# \u6ce8xxx.com\u8bf7\u6839\u636e\u81ea\u5df1\u7684\u57df\u540d\u81ea\u884c\u66f4\u6539<\/span>\r\n.\/certbot-auto --server https:\/\/acme-v02.api.letsencrypt.org\/directory -d<\/span> \"*.xxx.com\"<\/span> --manual --preferred-challenges dns-01 certonly\r\n<\/pre>\n\u6267\u884c\u5b8c\u8fd9\u4e00\u6b65\u4e4b\u540e\uff0c\u4f1a\u4e0b\u8f7d\u4e00\u4e9b\u9700\u8981\u7684\u4f9d\u8d56\uff0c\u7a0d\u7b49\u7247\u523b\u4e4b\u540e\uff0c\u4f1a\u63d0\u793a\u8f93\u5165\u90ae\u7bb1\uff0c\u968f\u4fbf\u8f93\u5165\u90fd\u884c<\/p>\n
<\/a><\/p>\n\u6ce8\u610f\uff0c\u7533\u8bf7\u901a\u914d\u7b26\u8bc1\u4e66\u662f\u8981\u7ecf\u8fc7DNS\u8ba4\u8bc1\u7684\uff0c\u6309\u7167\u63d0\u793a\uff0c\u524d\u5f80\u57df\u540d\u540e\u53f0\u6dfb\u52a0\u5bf9\u5e94\u7684DNS TXT\u8bb0\u5f55\u3002\u6dfb\u52a0\u4e4b\u540e\uff0c\u4e0d\u8981\u5fc3\u6025\u7740\u6309\u56de\u8f66\uff0c\u5148\u6267\u884ccertbot-auto renew<\/span>\u786e\u8ba4\u89e3\u6790\u8bb0\u5f55\u662f\u5426\u751f\u6548\uff0c\u751f\u6548\u4e4b\u540e\u518d\u56de\u53bb\u6309\u56de\u8f66\u786e\u8ba4dig xxxx.xxx.com txt<\/span>
\n<\/a><\/p>\n\u5230\u4e86\u8fd9\u4e00\u6b65\u540e\uff0c\u5927\u529f\u544a\u6210\uff01\uff01\uff01 \u8bc1\u4e66\u5b58\u653e\u5728\/etc\/letsencrypt\/live\/xxx.com\/\u91cc\u9762<\/p>\n
\u8981\u7eed\u671f\u7684\u8bdd\uff0c\u6267\u884ccertbot-auto renew<\/span> \u5c31\u53ef\u4ee5\u4e86<\/p>\n<\/a><\/p>\n\u4e0b\u9762\u662f\u4e00\u4e2anginx\u5e94\u7528\u8be5\u8bc1\u4e66\u7684\u4e00\u4e2a\u4f8b\u5b50<\/p>\n
server<\/span> {\r\n server_name<\/span> xxx.com;\r\n listen<\/span> 443<\/span> http2 ssl;\r\n ssl<\/span> on<\/span>;\r\n ssl_certificate<\/span> \/etc\/cert\/xxx.cn\/fullchain.pem;\r\n ssl_certificate_key<\/span> \/etc\/cert\/xxx.cn\/privkey.pem;\r\n ssl_trusted_certificate<\/span> \/etc\/cert\/xxx.cn\/chain.pem;\r\n\r\n location<\/span> \/ {\r\n proxy_pass<\/span> http:\/\/127.0.0.1:6666;\r\n }\r\n}\r\n\r\n<\/pre>\n<\/div>\n<\/div>\n\n\u539f\u6587\u6765\u81ea\uff1ahttps:\/\/my.oschina.net\/kimver\/blog\/1634575<\/a><\/p>\n