{"id":815,"date":"2019-11-01T20:34:32","date_gmt":"2019-11-01T20:34:32","guid":{"rendered":"http:\/\/blog.davcloud.top\/?p=815"},"modified":"2020-06-11T16:19:05","modified_gmt":"2020-06-11T16:19:05","slug":"%e5%b0%86wordpress%e7%ab%99%e7%82%b9%e4%bb%8ehttp%e5%88%87%e6%8d%a2%e8%87%b3https","status":"publish","type":"post","link":"https:\/\/blog.davcloud.top\/?p=815&lang=zh","title":{"rendered":"\u5c06WordPress\u7ad9\u70b9\u4ecehttp\u5207\u6362\u81f3https"},"content":{"rendered":"\n<h2>\u6458\u8981<\/h2>\n\n\n\n<p>\u8fd9\u7bc7\u6587\u7ae0\u5c06\u4f1a\u8bb0\u5f55\u5982\u4f55\u5c06Wordpress\u7ad9\u70b9\u4ecehttp\u5207\u6362\u81f3https\u3002<\/p>\n\n\n\n<p class=\"has-text-color has-vivid-red-color\">\u6ce8\u610f\uff1a\u786e\u5b9a\u7ad9\u70b9\u80fd\u591f\u901a\u8fc7http\u534f\u8bae\u6b63\u786e\u8bbf\u95ee\uff0c\u5426\u5219\u5728\u7ecf\u8fc7\u5982\u4e0b\u6b65\u9aa4\u5207\u6362\u81f3https\u540e\uff0c\u53ef\u80fd\u65e0\u6cd5\u518d\u6b21\u8bbf\u95ee\u7ad9\u70b9\u3002<\/p>\n\n\n\n<h2>\u6b65\u9aa4\u4e00\uff1a\u6253\u5f00wp-config.php\u6587\u4ef6<\/h2>\n\n\n\n<p>\u6253\u5f00wp-config.php\u6587\u4ef6\uff0c\u5047\u8bbeWordpress\u5b89\u88c5\u7684\u6839\u76ee\u5f55\u4e3a\u201cwordpress\u201d\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \u5982\u679c\u64cd\u4f5c\u76ee\u5f55\u9700\u8981root\u6743\u9650\uff0c\u5219\u5728\u547d\u4ee4\u5f00\u59cb\u5904\u6dfb\u52a0sudo\nvim \/wordpress\/wp-config.php<\/code><\/pre>\n\n\n\n<h2>\u6b65\u9aa4\u4e8c\uff1a\u7f16\u8f91\u6587\u4ef6<\/h2>\n\n\n\n<p>\u5728\u6587\u4ef6\u4e2d\u7684\u7b2c\u4e00\u4e2a <code>&lt;?php<\/code> \u540e\u6dfb\u52a0\u5982\u4e0b\u8bed\u53e5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$_SERVER&#91;'HTTPS'] = 'on';\ndefine('FORCE_SSL_LOGIN', true);\ndefine('FORCE_SSL_ADMIN', true);<\/code><\/pre>\n\n\n\n<h2>\u6b65\u9aa4\u4e09\uff1a\u4fee\u6539\u7f51\u7ad9\u5730\u5740<\/h2>\n\n\n\n<p>\u5728Wordpress\u7ba1\u7406\u540e\u53f0\u7684Settings\/General\u9009\u9879\u5361\u4e2d\uff0c\u5c06\u7f51\u5740\u66f4\u6539\u4e3a\u6b63\u786e\u7684https\u7f51\u5740\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"725\" height=\"121\" src=\"https:\/\/blog.davcloud.top\/wp-content\/uploads\/2019\/11\/image-2.png\" alt=\"\" class=\"wp-image-819\" srcset=\"https:\/\/blog.davcloud.top\/wp-content\/uploads\/2019\/11\/image-2.png 725w, https:\/\/blog.davcloud.top\/wp-content\/uploads\/2019\/11\/image-2-300x50.png 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/figure><\/div>\n\n\n\n<h2>\u6b65\u9aa4\u56db\uff1a\u914d\u7f6eApache\u865a\u62df\u4e3b\u673a\u6587\u4ef6<\/h2>\n\n\n\n<p>\u4e3awordpress\u670d\u52a1\u65b0\u5efa\u4e00\u4e2aapache\u914d\u7f6e\u6587\u4ef6\uff0c\u5047\u8bbeapache\u88ab\u5b89\u88c5\u5728 <code>\/etc\/httpd<\/code> \u76ee\u5f55\uff0c\u6587\u4ef6\u540d\u4e3a <code>blog.conf<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/httpd\/conf.d\/blog.conf<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>SSLPassPhraseDialog  builtin\nSSLSessionCache         shmcb:\/var\/cache\/mod_ssl\/scache(512000)\nSSLSessionCacheTimeout  300\nSSLRandomSeed startup file:\/dev\/urandom  256\nSSLRandomSeed connect builtin\nSSLCryptoDevice builtin\nSSLProtocol all -SSLv2 -SSLv3\nSSLHonorCipherOrder on\nSSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW:!RC4:\n\n&lt;VirtualHost _default_:80>\n    # \u6b64\u5904\u66ff\u6362\u4e3a\u6b63\u786e\u7684\u7f51\u5740\n    Servername www.example.com\n    ErrorLog logs\/error_log\n    TransferLog logs\/access_log\n    LogLevel warn\n\n    # 301 \u8df3\u8f6c\n    RewriteEngine on\n    RewriteCond   %{HTTPS} !=on\n    RewriteRule   ^(.*)  https:\/\/%{SERVER_NAME}$1 &#91;L,R] \n&lt;\/VirtualHost>\n\n&lt;VirtualHost _default_:443>\n    # \u6b64\u5904\u66ff\u6362\u4e3a\u6b63\u786e\u7684\u7f51\u5740\n    Servername www.example.com\n    ErrorLog logs\/ssl_error_log\n    TransferLog logs\/ssl_access_log\n    LogLevel warn\n    SSLEngine on\n    # \u6b64\u5904\u66ff\u6362\u4e3aSSL\u8bc1\u4e66\u6240\u5728\u7684\u76ee\u5f55\n    SSLCertificateFile path_of_cert_file\n    SSLCertificateKeyFile path_of_cert_key_file\n    RewriteEngine On\n\n    SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=$1\n    ProxyPass \/ http:\/\/www.example.com\/\n    ProxyPassReverse \/ http:\/\/www.example.com\/\n&lt;\/VirtualHost><\/code><\/pre>\n\n\n\n<p>\u5bf9\u4e8e80\u7aef\u53e3\u7684\u76d1\u542c\uff08http\u534f\u8bae\uff09\uff0c\u4f7f\u7528301\u8df3\u8f6c\u4ee5\u5f3a\u5236\u8fdb\u884chttps\u8bbf\u95ee\u3002<\/p>\n\n\n\n<h2>\u6b65\u9aa4\u4e94\uff1a\u91cd\u65b0\u52a0\u8f7dApache\u670d\u52a1\u5e76\u8bbf\u95eeWordpress\u7ad9\u70b9\u7684https\u7f51\u5740<\/h2>\n\n\n\n<p>\u91cd\u65b0\u52a0\u8f7dapache\u670d\u52a1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl reload httpd<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528https\u7f51\u5740\u8bbf\u95eeWordpress\u7ad9\u70b9\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6458\u8981 \u8fd9\u7bc7\u6587\u7ae0\u5c06\u4f1a\u8bb0\u5f55\u5982\u4f55\u5c06Wordpress\u7ad9\u70b9\u4ecehttp\u5207\u6362\u81f3https\u3002 \u6ce8\u610f\uff1a\u786e\u5b9a\u7ad9\u70b9\u80fd\u591f\u901a\u8fc7http\u534f\u8bae\u6b63\u786e\u8bbf\u95ee\uff0c\u5426\u5219\u5728\u7ecf\u8fc7\u5982\u4e0b\u6b65\u9aa4\u5207\u6362\u81f3https\u540e\uff0c\u53ef\u80fd\u65e0\u6cd5\u518d\u6b21\u8bbf\u95ee\u7ad9\u70b9\u3002 \u6b65\u9aa4\u4e00\uff1a\u6253\u5f00wp-config.php\u6587\u4ef6 \u6253\u5f00wp-config.php\u6587\u4ef6\uff0c\u5047\u8bbeWordpress\u5b89\u88c5\u7684\u6839\u76ee\u5f55\u4e3a\u201cwordpress\u201d\uff1a \u6b65\u9aa4\u4e8c\uff1a\u7f16\u8f91\u6587\u4ef6 \u5728\u6587\u4ef6\u4e2d\u7684\u7b2c\u4e00\u4e2a &lt;?php \u540e\u6dfb\u52a0\u5982\u4e0b\u8bed\u53e5\uff1a \u6b65\u9aa4\u4e09\uff1a\u4fee\u6539\u7f51\u7ad9\u5730\u5740 \u5728Wordpress\u7ba1\u7406\u540e\u53f0\u7684Settings\/General\u9009\u9879\u5361\u4e2d\uff0c\u5c06\u7f51\u5740\u66f4\u6539\u4e3a\u6b63\u786e\u7684https\u7f51\u5740\uff1a \u6b65\u9aa4\u56db\uff1a\u914d\u7f6eApache\u865a\u62df\u4e3b\u673a\u6587\u4ef6 \u4e3awordpress\u670d\u52a1\u65b0\u5efa\u4e00\u4e2aapache\u914d\u7f6e\u6587\u4ef6\uff0c\u5047\u8bbeapache\u88ab\u5b89\u88c5\u5728 \/etc\/httpd \u76ee\u5f55\uff0c\u6587\u4ef6\u540d\u4e3a blog.conf: \u5bf9\u4e8e80\u7aef\u53e3\u7684\u76d1\u542c\uff08http\u534f\u8bae\uff09\uff0c\u4f7f\u7528301\u8df3\u8f6c\u4ee5\u5f3a\u5236\u8fdb\u884chttps\u8bbf\u95ee\u3002 \u6b65\u9aa4\u4e94\uff1a\u91cd\u65b0\u52a0\u8f7dApache\u670d\u52a1\u5e76\u8bbf\u95eeWordpress\u7ad9\u70b9\u7684https\u7f51\u5740 \u91cd\u65b0\u52a0\u8f7dapache\u670d\u52a1\uff1a \u4f7f\u7528https\u7f51\u5740\u8bbf\u95eeWordpress\u7ad9\u70b9\u5373\u53ef\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[389],"tags":[424,444,564,578],"_links":{"self":[{"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=\/wp\/v2\/posts\/815"}],"collection":[{"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=815"}],"version-history":[{"count":6,"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=\/wp\/v2\/posts\/815\/revisions"}],"predecessor-version":[{"id":826,"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=\/wp\/v2\/posts\/815\/revisions\/826"}],"wp:attachment":[{"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.davcloud.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}