{"id":2220,"date":"2018-01-21T11:36:17","date_gmt":"2018-01-21T03:36:17","guid":{"rendered":"http:\/\/www.51cos.com\/?p=2220"},"modified":"2018-01-21T12:55:45","modified_gmt":"2018-01-21T04:55:45","slug":"%e9%98%bf%e9%87%8c%e4%ba%91ubuntulnmp","status":"publish","type":"post","link":"http:\/\/www.51cos.com\/?p=2220","title":{"rendered":"\u963f\u91cc\u4e91+UBUNTU+LNMP\u73af\u5883\u4e0b\uff0c\u7f51\u7ad9\u914d\u7f6eSSL\u5b89\u5168\u8bc1\u4e66\u5f00\u542fhttps\u8bbf\u95ee\u8be6\u7ec6\u6559\u7a0b"},"content":{"rendered":"<p>\n1.\u81ea\u52a8\u5b89\u88c5\uff1a<\/p>\n<p> wget https:\/\/dl.eff.org\/certbot-auto<br \/>\nchmod a+x certbot-auto<br \/>\n.\/certbot-auto  <\/p>\n<p> 2.\u751f\u6210\u57df\u540d\u8bc1\u4e66<br \/>\n .\/certbot-auto certonly &#8211;email xxxxx@qq.com &#8211;agree-tos &#8211;webroot -w \/home\/wwwroot\/xxxxx -d www.xxxxx.com  <\/p>\n<p>Saving debug log to \/var\/log\/letsencrypt\/letsencrypt.log<br \/>\nPlugins selected: Authenticator webroot, Installer None<br \/>\nObtaining a new certificate<br \/>\nPerforming the following challenges:<br \/>\nhttp-01 challenge for www.xxxxx.com<br \/>\nUsing the webroot path \/home\/wwwroot\/xxxxx for all unmatched domains.<br \/>\nWaiting for verification&#8230;<br \/>\nCleaning up challenges<\/p>\n<p>IMPORTANT NOTES:<br \/>\n &#8211; Congratulations! Your certificate and chain have been saved at:<br \/>\n   \/etc\/letsencrypt\/live\/www.xxxxx.com\/fullchain.pem<br \/>\n   Your key file has been saved at:<br \/>\n   \/etc\/letsencrypt\/live\/www.xxxxx.com\/privkey.pem<br \/>\n   Your cert will expire on 2018-04-21. To obtain a new or tweaked<br \/>\n   version of this certificate in the future, simply run certbot-auto<br \/>\n   again. To non-interactively renew *all* of your certificates, run<br \/>\n   &#8220;certbot-auto renew&#8221;<br \/>\n &#8211; If you like Certbot, please consider supporting our work by:<\/p>\n<p>   Donating to ISRG \/ Let&#8217;s Encrypt:   https:\/\/letsencrypt.org\/donate<br \/>\n   Donating to EFF:                    https:\/\/eff.org\/donate-le  <\/p>\n<p>3. \u5982\u679c\u662f\u7528\u7684lnmp\uff0c\u4e00\u5b9a\u8981\u6ce8\u610f\u8fd9\u4e24\u4e2a\u6587\u4ef6\uff1a<\/p>\n<p>\/usr\/local\/nginx\/conf\/vhost\/www.xxxxx.com.conf #\u4f60\u7684\u57df\u540d\u5bf9\u5e94\u7684\u6587\u4ef6  <\/p>\n<p> \u8bf7\u628a\u91cc\u9762\u7684\u4ee5\u4e0b\u5185\u5bb9\uff1a<br \/>\n         location ~ \/\\.<br \/>\n        {<br \/>\n            deny all;<br \/>\n        }  <\/p>\n<p> \u6682\u65f6\u66f4\u6539\u4e3a\uff1a<br \/>\n         location ~ \/\\.<br \/>\n        {<br \/>\n            allow all;<br \/>\n        }  <\/p>\n<p>\u5426\u5219\u83b7\u53d6\u8ba4\u8bc1\u8bc1\u4e66\u7684\uff0c\u603b\u5931\u8d25\uff0c\u63d0\u793a403 Forbidden\u3002<\/p>\n<p>\u7136\u540e\u5728\/usr\/local\/nginx\/conf\/vhost\/www.xxxxx.com.conf #\u4f60\u7684\u57df\u540d\u5bf9\u5e94\u7684\u6587\u4ef6\uff0c\u6700\u4e0a\u9762\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff0c\u6ce8\u610f\u8981\u628axxxx\u7684\u5730\u65b9\u6539\u6210\u4f60\u81ea\u5df1\u7684\u3002<\/p>\n<p>         server<br \/>\n        {<br \/>\n                listen 443 ssl;<br \/>\n                ssl on;<br \/>\n                server_name www.xxxxx.com xxxxx.com;<br \/>\n                index index.html index.htm index.php default.html default.htm default.php;<br \/>\n                root  \/home\/wwwroot\/xxxxx;<\/p>\n<p>                ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<br \/>\n                ssl_prefer_server_ciphers on;<br \/>\n                ssl_certificate \/etc\/letsencrypt\/live\/www.xxxxx.com\/fullchain.pem;<br \/>\n                ssl_certificate_key \/etc\/letsencrypt\/live\/www.xxxxx.com\/privkey.pem;<br \/>\n                ssl_session_timeout 5m;<\/p>\n<p>                include none.conf;<br \/>\n                #error_page   404   \/404.html;<br \/>\n                include enable-php.conf;<br \/>\n        }  <\/p>\n<p>\u8fd9\u4e2a\u65f6\u5019\u901a\u8fc7https\u5e94\u8be5\u5c31\u80fd\u8bbf\u95ee\u4f60\u7684\u7f51\u7ad9\u4e86\uff01\u53ef\u4ee5\u901a\u8fc7https:\/\/www.ssllabs.com\/ssltest\/\u6d4b\u8bd5\u4f60\u7f51\u7ad9\u5b89\u5168\u7b49\u7ea7\u3002<\/p>\n<p>\u51fa\u4e8e\u5b89\u5168\u7b56\u7565\uff0c Let\u2019s Encrypt \u7b7e\u53d1\u7684\u8bc1\u4e66\u6709\u6548\u671f\u53ea\u6709 90 \u5929\uff0c\u6240\u4ee5\u9700\u8981\u6bcf\u9694\u4e09\u4e2a\u6708\u5c31\u8981\u66f4\u65b0\u4e00\u6b21\u5b89\u5168\u8bc1\u4e66\uff0c\u867d\u7136\u6709\u70b9\u9ebb\u70e6\uff0c\u4f46\u662f\u4e3a\u4e86\u7f51\u7edc\u5b89\u5168\uff0c\u8fd9\u662f\u503c\u5f97\u7684\u4e5f\u662f\u5e94\u8be5\u7684\u3002\u597d\u5728 Certbot \u4e5f\u63d0\u4f9b\u4e86\u5f88\u65b9\u4fbf\u7684\u66f4\u65b0\u65b9\u6cd5\u3002<\/p>\n<p>1.\u6d4b\u8bd5\u4e00\u4e0b\u66f4\u65b0\uff0c\u8fd9\u4e00\u6b65\u6ca1\u6709\u5728\u771f\u7684\u66f4\u65b0\uff0c\u53ea\u662f\u5728\u8c03\u7528 Certbot \u8fdb\u884c\u6d4b\u8bd5<\/p>\n<p> .\/certbot-auto renew &#8211;dry-run<br \/>\n \u5982\u679c\u770b\u5230\u5982\u4e0b\u4fe1\u606f\u8bf4\u660e\u6d4b\u8bd5\u6210\u529f\uff1a<br \/>\n Congratulations, all renewals succeeded. The following certs have been renewed:<br \/>\n  \/etc\/letsencrypt\/live\/www.xxxx.com\/fullchain.pem (success)  <\/p>\n<p>2.\u7528 crontab \u5b9a\u65f6\u66f4\u65b0<\/p>\n<p> # \u7f16\u8f91 crontab<br \/>\ncrontab -e<br \/>\n# \u6bcf\u9694\u4e24\u4e2a\u67081\u53f7\u7684\u96f6\u70b9\u5c31\u4f1a\u81ea\u52a8\u66f4\u65b0\u8bc1\u4e66\uff0c5\u5206\u949f\u540enginx\u91cd\u65b0\u52a0\u8f7d\u914d\u7f6e\u3002\u6ce8\u610fcertbot-auto\u66f4\u6539\u6210\u4f60\u81ea\u5df1\u7684<\/p>\n<p>00 00 1 2,4,6,8,10,12 * \/usr\/local\/certbot-auto renew &#8211;quiet &#8211;no-self-upgrade<br \/>\n05 00 1 2,4,6,8,10,12 * lnmp restart  <\/p>\n<p>\u53c2\u8003\u7f51\u7ad9\uff1a <\/p>\n<blockquote class=\"wp-embedded-content\" data-secret=\"y0MZboHnO8\"><p><a href=\"https:\/\/yukun.im\/server\/662\">\u4f7f\u7528Let&#8217;s Encrypt\u514d\u8d39SSL\u8bc1\u4e66 ubuntu \u6559\u7a0b<\/a><\/p><\/blockquote>\n<p><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; visibility: hidden;\" title=\"\u300a \u4f7f\u7528Let&#8217;s Encrypt\u514d\u8d39SSL\u8bc1\u4e66 ubuntu \u6559\u7a0b \u300b\u2014Yukun\u7684blog\" src=\"https:\/\/yukun.im\/server\/662\/embed#?secret=rNBgnoi70u#?secret=y0MZboHnO8\" data-secret=\"y0MZboHnO8\" width=\"580\" height=\"327\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe><br \/>\nhttp:\/\/www.vlanling.com\/.well-known\/acme-challenge<br \/>\nhttps:\/\/www.vpser.net\/manage\/crontab.html<br \/>\nhttps:\/\/www.appinn.com\/use-letsencrypt-with-nginx\/<br \/>\nhttp:\/\/frontenddev.org\/article\/using-certbot-deployment-let-s-encrypt-free-ssl-certificate-implementation-https.html  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u81ea\u52a8\u5b89\u88c5\uff1a wget https:\/\/dl.eff.org\/certbot-auto chmod a+x  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-2220","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/2220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2220"}],"version-history":[{"count":8,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/2220\/revisions"}],"predecessor-version":[{"id":2228,"href":"http:\/\/www.51cos.com\/index.php?rest_route=\/wp\/v2\/posts\/2220\/revisions\/2228"}],"wp:attachment":[{"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2220"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.51cos.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}