{"id":3580,"date":"2021-08-24T13:48:43","date_gmt":"2021-08-24T05:48:43","guid":{"rendered":"http:\/\/101.37.83.176\/?p=3580"},"modified":"2024-03-20T10:31:32","modified_gmt":"2024-03-20T02:31:32","slug":"ssl2wordpress","status":"publish","type":"post","link":"http:\/\/101.37.83.176\/?p=3580","title":{"rendered":"\u4f7f\u7528SSL\u5efa\u7acb\u8fde\u7ebf\u52a0\u5bc6\u7f51\u7ad9 (https)"},"content":{"rendered":"<p>\u5199\u5728\u524d\u9762\u7684\u8bdd<\/p>\n<p>\u7531\u4e8e\u8981\u5e03\u8bbehttps\uff0c\u4f46\u53c8\u56ca\u4e2d\u7f9e\u6da9\uff0c\u53ea\u4e3awangjingye.com\u57df\u540d\u8d2d\u4e70\u4e86\u8bc1\u4e66\uff0c\u56e0\u6b64wangjingye.com\u7684\u57df\u540d\u4e0d\u80fd\u7528\u4e86\u3002\u8bf8\u541b\u89c1\u8c05\u3002<\/p>\n<hr \/>\n<p>\u4f7f\u7528SSL\u8bc1\u4e66\uff08SSL Certificates\uff09\u4e3a\u7f51\u7ad9\u63d0\u4f9b\u6570\u636eHTTPS\u52a0\u5bc6\u534f\u8bae\u8bbf\u95ee\uff0c\u4fdd\u969c\u6570\u636e\u7684\u5b89\u5168\u3002\u88c5\u8f7dSSL\u8bc1\u4e66\u4ea7\u54c1\u540e\u81ea\u52a8\u6fc0\u6d3b\u6d4f\u89c8\u5668\u4e2d\u663e\u793a\u201c\u9501\u201d\u578b\u5b89\u5168\u6807\u5fd7\uff0c\u5730\u5740\u680f\u4ee5\u201chttps\u201d\u5f00\u5934\u3002<\/p>\n<p>0\u3001\u8d2d\u4e70SSL\u8bc1\u4e66\u6587\u4ef6\u3002<\/p>\n<p>1\u3001\u5728Apache\u7684\u5b89\u88c5\u76ee\u5f55\uff08\u9ed8\u8ba4\/etc\/httpd\uff09\u4e0b\uff0c\u65b0\u5efacert\u76ee\u5f55\u3002\u5e76\u5c06\u8bc1\u4e66\u3001\u8bc1\u4e66\u94fe\u6587\u4ef6\u548c\u5bc6\u94a5\u6587\u4ef6\u62f7\u8d1d\u5230cert\u76ee\u5f55\u4e2d\u3002\u5982\u679c\u9700\u8981\u5b89\u88c5\u591a\u4e2a\u8bc1\u4e66\uff0c\u9700\u5728Apache\u76ee\u5f55\u4e2d\u65b0\u5efa\u5bf9\u5e94\u6570\u91cf\u7684cert\u76ee\u5f55\uff0c\u7528\u4e8e\u5b58\u653e\u4e0d\u540c\u7684\u8bc1\u4e66 \u3002<\/p>\n<p>2\u3001\u67e5\u770b\u5728 \/etc\/httpd\/modules\u4e0b\u662f\u5426\u6709mod_ssl.so\u6a21\u5757\uff0c\u82e5\u672a\u5b89\u88c5 mod_ssl.so \u6a21\u5757\uff0c\u60a8\u53ef\u901a\u8fc7\u6267\u884cyum install mod_ssl \u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>3\u3001\u67e5\u770b\u5728 \/etc\/httpd\/conf.modules.d \u76ee\u5f55\u4e0b\u7684 00-ssl.conf \u914d\u7f6e\u6587\u4ef6\u627e\u5230 LoadModule ssl_module modules\/mod_ssl.so\uff08\u7528\u4e8e\u52a0\u8f7d SSL \u6a21\u5757\uff09\u914d\u7f6e\u8bed\u53e5\uff0c\u82e5\u5df2\u6ce8\u91ca\uff0c\u8bf7\u53bb\u6389\u9996\u884c\u7684\u6ce8\u91ca\u7b26\u53f7\uff08#\uff09\u3002<\/p>\n<p>4\u3001\u7f16\u8f91 \/etc\/httpd\/conf.d \u76ee\u5f55\u4e0b\u7684 ssl.conf \u914d\u7f6e\u6587\u4ef6\u3002\u4fee\u6539\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">VirtualHost *:443\r\nServerName #\u4fee\u6539\u4e3a\u7533\u8bf7\u8bc1\u4e66\u65f6\u7ed1\u5b9a\u7684\u57df\u540dwww.YourDomainName1.com\u3002\r\nDocumentRoot \/var\/www\/html\r\nSSLEngine on\r\nSSLProtocol all -SSLv2 -SSLv3 # \u6dfb\u52a0SSL\u534f\u8bae\u652f\u6301\u534f\u8bae\uff0c\u53bb\u6389\u4e0d\u5b89\u5168\u7684\u534f\u8bae\u3002\r\nSSLCipherSuite HIGH:!RC4:!MD5:!aNULL:!eNULL:!NULL:!DH:!EDH:!EXP:+MEDIUM # \u4fee\u6539\u52a0\u5bc6\u5957\u4ef6\u3002\r\nSSLHonorCipherOrder on\r\nSSLCertificateFile cert\/domain name1_public.crt # \u5c06domain name1_public.crt\u66ff\u6362\u6210\u60a8\u8bc1\u4e66\u6587\u4ef6\u540d\u3002\r\nSSLCertificateKeyFile cert\/domain name1.key # \u5c06domain name1.key\u66ff\u6362\u6210\u60a8\u8bc1\u4e66\u7684\u5bc6\u94a5\u6587\u4ef6\u540d\u3002\r\nSSLCertificateChainFile cert\/domain name1_chain.crt # \u5c06domain name1_chain.crt\u66ff\u6362\u6210\u60a8\u8bc1\u4e66\u7684\u5bc6\u94a5\u6587\u4ef6\u540d\uff1b\u8bc1\u4e66\u94fe\u5f00\u5934\u5982\u679c\u6709#\u5b57\u7b26\uff0c\u8bf7\u5220\u9664\u3002\r\n\/VirtualHost<\/pre>\n<p>5\u3001\u67e5\u770b\u5728 \/etc\/httpd\/modules\u4e0b\u662f\u5426\u6709mod_ssl.so\u6a21\u5757\u3002\u6ca1\u6709\u5219\u5b89\u88c5\u3002<\/p>\n<p>6\u3001\u5728\/etc\/httpd\/conf.modules.d\u4e2d\u65b0\u5efa\u4e00\u4e2a *.conf \u6587\u4ef6\uff0c\u4f8b\u5982 00-rewrite.conf\u3002\u5728\u65b0\u5efa\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">LoadModule rewrite_module modules\/mod_rewrite.so<\/pre>\n<p>7\u3001\u5728 httpd.conf \u914d\u7f6e\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5982\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">Directory &quot;\/var\/www\/html&quot;\r\n# \u81ea\u52a8http\u91cd\u5b9a\u5411https\r\nRewriteEngine on\r\nRewriteCond %{SERVER_PORT} !^443$\r\nRewriteRule ^(.*)?$ https:\/\/%{SERVER_NAME}%{REQUEST_URI} &#x5B;L,R]\r\n\/Directory<\/pre>\n<p>8\u3001\u91cd\u542fApache\u670d\u52a1\u5668<\/p>\n<p>9\u3001\u8fdb\u5165WordPress\u9762\u677f\uff0c\u4f9d\u6b21\u70b9\u51fb\u8bbe\u7f6e&gt; \u901a\u7528\uff0c\u7136\u540e\u5411\u4e0b\u6ed1\u52a8\u5230WordPress\u5730\u5740\uff08URL\uff09\u548c\u7f51\u7ad9\u5730\u5740\uff08URL\uff09\u5b57\u6bb5\uff0c\u5c06https:\/\/\u66ff\u6362\u4e3ahttp:\/\/\u3002<\/p>\n<p>10\u3001\u89e3\u51b3SSL\u7ad9\u70b9\u540e\u56fe\u7247\u5931\u6548\u95ee\u9898\u3002<\/p>\n<p>WordPress\u5f00\u542fHTTPS\u540e\uff0c\u535a\u5ba2\u539f\u6765\u4e0a\u4f20\u7684\u56fe\u7247\u5730\u5740\u4f9d\u65e7\u4e3ahttp\u7684\u94fe\u63a5\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u5730\u5740\u680f\u7eff\u9501\u663e\u793a\u4e0d\u6b63\u5e38\uff0c\u89e3\u51b3\u65b9\u6cd5\u5982\u4e0b\uff1a\u6279\u91cf\u5904\u7406WordPress\u66f4\u6539\u56fe\u7247\u5730\u5740http\u4e3ahttps\uff0c\u901a\u8fc7\u4fee\u6539MySQL\u6570\u636e\u5e93\uff0c\u5c06\u6240\u6709wp-content\/uploads\u4e0b\u7684\u56fe\u7247\u94fe\u63a5\u5747\u6539\u4e3ahttps\u3002<\/p>\n<p>\u4f7f\u7528phpMyAdmin\u767b\u5f55WordPress\u7684MySQL\u6570\u636e\u5e93\uff0c\u5e76\u9009\u62e9\u4f60\u7684WordPress\u6570\u636e\u5e93\uff0c\u70b9\u51fb\u201cSQL\u201d\uff0c\u8f93\u5165\u4ee5\u4e0b\u8bed\u53e5\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">UPDATE wp_posts SET post_content = replace(post_content, &#039;http:\/\/\u57df\u540d\/wp-content\/uploads&#039;, &#039;https:\/\/\u57df\u540d\/wp-content\/uploads&#039;);<\/pre>\n<p>\u6ce8\u610f\uff1a<br \/>\na. \u64cd\u4f5c\u524d\u8bf7\u52a1\u5fc5\u5bf9\u6570\u636e\u5e93\u8fdb\u884c\u5907\u4efd\uff0c\u4ee5\u907f\u514d\u4e0d\u53ef\u633d\u56de\u7684\u6570\u636e\u4e22\u5931!<br \/>\nb. \u201cwp_posts\u201d\uff1a\u9ed8\u8ba4\u8868\u524d\u7f00\u4e3awp\uff0c\u5982\u679c\u4f60\u4fee\u6539\u4e86\u8868\u524d\u7f00\uff0c\u8bf7\u6539\u6210\u81ea\u5df1\u7684\u524d\u7f00\uff1b<br \/>\nc. \u5c06\u201c\u57df\u540d\u201d\u6539\u6210\u81ea\u5df1\u7684\u57df\u540d.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u963f\u91cc\u4e91\u4f7f\u7528SSL\u5efa\u7acb\u8fde\u7ebf\u52a0\u5bc6\u7f51\u7ad9 (https)\u53ca\u5176\u6ce8\u610f\u4e8b\u9879\u3002<\/p>\n","protected":false},"author":1,"featured_media":4228,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[71],"tags":[74,200,239],"class_list":["post-3580","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lamp","tag-lamp","tag-ssl","tag-wordpress"],"_links":{"self":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts\/3580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3580"}],"version-history":[{"count":3,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts\/3580\/revisions"}],"predecessor-version":[{"id":4712,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts\/3580\/revisions\/4712"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/media\/4228"}],"wp:attachment":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3580"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}