{"id":1,"date":"2018-06-14T19:28:53","date_gmt":"2018-06-14T10:28:53","guid":{"rendered":"http:\/\/vongg.com\/?p=1"},"modified":"2019-06-15T18:24:41","modified_gmt":"2019-06-15T09:24:41","slug":"httpsletsencrypt","status":"publish","type":"post","link":"https:\/\/vongg.com\/?p=1","title":{"rendered":"\u5728centos\u73af\u5883\u4e0b\u7ed9\u591a\u57df\u540d\u7ad9\u70b9\u914d\u7f6ehttps\u514d\u8d39\u8bc1\u4e66(Let\u2019s Encrypt)"},"content":{"rendered":"<h2>Step1\uff0c\u5b89\u88c5 cerbot\u548ccerbot-apache<\/h2>\n<p style=\"padding-left: 30px;\">\u00a0yum install certbot certbot-apache<\/p>\n<h2>Step2\uff0c\u5f00\u653e443\u7aef\u53e3<\/h2>\n<p style=\"padding-left: 30px;\">firewall-cmd &#8211;add-port=443\/tcp &#8211;zone=public &#8211;permanent<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Noto Serif',serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">firewall-cmd &#8212;<\/span>reload<\/p>\n<h2>Step3\uff0c\u914d\u7f6e\u865a\u62df\u57df\u540d<\/h2>\n<h2 style=\"padding-left: 30px;\"><span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; font-family: '\u6e38\u30b4\u30b7\u30c3\u30af\u4f53','Yu Gothic','Hiragino Kaku Gothic Pro','Meiryo',sans-serif; font-size: 16px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px; word-wrap: break-word;\">vi \/etc\/httpd\/conf\/httpd.conf <\/span><\/h2>\n<p style=\"padding-left: 30px;\">NameVirtualHost *:80<\/p>\n<p style=\"padding-left: 30px;\">&lt;VirtualHost *:80&gt;<br \/>\nServerAdmin root@<b>xxxx.com<\/b><br \/>\nDocumentRoot \/var\/www\/html<br \/>\nServerName <b>xxxx.com<\/b><br \/>\n&lt;\/VirtualHost&gt;<\/p>\n<p style=\"padding-left: 30px;\"><span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Noto Serif',serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">&lt;VirtualHost *:80&gt;<\/span><br \/>\n<span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Noto Serif',serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">ServerAdmin root@<b>xxxx.com<\/b><\/span><br \/>\n<span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Noto Serif',serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">DocumentRoot \/var\/www\/html<\/span><br \/>\n<span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Noto Serif',serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">ServerName www.<\/span><strong>xxxx.com<\/strong><br \/>\n<span style=\"display: inline !important; float: none; background-color: transparent; color: #333333; cursor: text; font-family: 'Noto Serif',serif; font-size: 17px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;\">&lt;\/VirtualHost&gt;<\/span><\/p>\n<h2>Step4\uff0c\u591a\u57df\u540dSSL\u8bc1\u4e66\u751f\u6210<\/h2>\n<p style=\"padding-left: 30px;\">certbot run <del>&#8211;apache<\/del> -d host1.xxxx.com -d host2.xxxx.com<\/p>\n<p>\u00a0 \u00a0 \u00a0\u00a0 \u203b\u9047\u5230\u5bf9\u8bdd\uff0c\u5168\u90e8\u540c\u610f\uff0c\u624d\u80fd\u901a\u8fc7\u3002\u4e0b\u9762\u5bf9\u8bdd\u6846\uff0c\u5efa\u8bae\u90092\uff0c\u5168\u90e8\u91cd\u5b9a\u5411\u5230https\u3002<\/p>\n<p style=\"padding-left: 30px;\">Please choose whether HTTPS access is required or optional.<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n1: Easy &#8211; Allow both HTTP and HTTPS access to these sites<br \/>\n2: Secure &#8211; Make all requests redirect to secure HTTPS access<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u203b\u6267\u884c\u5b8c\u6210\u540e\uff0c\u67e5\u770b\/etc\/httpd\/conf\/httpd.conf\u6587\u4ef6\u4f1a\u53d1\u73b0\u5728\u865a\u62df\u57df\u540d\u88ab\u8ffd\u52a0\u4e86\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<p style=\"padding-left: 30px;\">RewriteCond %{SERVER_NAME} =host.exsample.com<br \/>\nRewriteRule ^ https:\/\/%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]<\/p>\n<h2>Step5\uff0c\u914d\u7f6essl.conf\u6587\u4ef6<\/h2>\n<p style=\"padding-left: 30px;\">vi \/etc\/httpd\/conf.d\/ssl.conf<\/p>\n<p style=\"padding-left: 30px;\">SSLCertificateFile \/etc\/letsencrypt\/live\/xxxx.com\/fullchain.pem<br \/>\nSSLCertificateKeyFile \/etc\/letsencrypt\/live\/xxx.com\/privkey.pem<\/p>\n<h2>Step6\uff0c\u91cd\u542fhttpd\u670d\u52a1<\/h2>\n<p style=\"padding-left: 30px;\">systemctl restart httpd<\/p>\n<h2>Step7\uff0c\u8bc1\u660e\u4e66\u66f4\u65b0\uff08\u9700\u8981\u65f6\uff09<\/h2>\n<p style=\"padding-left: 30px;\">\u56e0\u4e3aletsencrypt\u7684\u8bc1\u4e66\u6709\u6548\u671f\u9650\u662f\u4e09\u4e2a\u6708\uff0c\u6240\u4ee5\u6bcf\u4e09\u4e2a\u6708\u8981\u66f4\u65b0\u4e00\u6b21<\/p>\n<p style=\"padding-left: 30px;\">certbot renew<\/p>\n<p>\u00a0 \u00a0 \u00a0\u00a0 \u5efa\u8bae\u5c06\u4e0a\u8fb9\u7684\u547d\u4ee4\u653e\u5230cron\u91cc\u81ea\u52a8\u6267\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step1\uff0c\u5b89\u88c5 cerbot\u548ccerbot-apache \u00a0yum install certbot cert [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[44,2,53],"tags":[52],"_links":{"self":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/1"}],"collection":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1"}],"version-history":[{"count":5,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":1075,"href":"https:\/\/vongg.com\/index.php?rest_route=\/wp\/v2\/posts\/1\/revisions\/1075"}],"wp:attachment":[{"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vongg.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}