{"id":4588,"date":"2016-06-04T02:00:39","date_gmt":"2016-06-03T18:00:39","guid":{"rendered":"https:\/\/www.icocean.com\/blog\/?p=4588"},"modified":"2016-06-04T02:00:39","modified_gmt":"2016-06-03T18:00:39","slug":"discuz-x3-2%e5%ae%8c%e7%be%8e%e5%bc%80%e5%90%afhttps%e6%95%99%e7%a8%8b%ef%bc%88%e5%ae%8c%e6%95%b4%e7%89%88%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=4588","title":{"rendered":"Discuz x3.2\u5b8c\u7f8e\u5f00\u542fhttps\u6559\u7a0b\uff08\u5b8c\u6574\u7248\uff09"},"content":{"rendered":"<p>\u524d\u63d0\uff1a\u5df2\u7ecf\u62e5\u6709\u57df\u540d\u8bc1\u4e66\uff0c\u4e14\u670d\u52a1\u5668\u652f\u6301\u6dfb\u52a0SSL\u8bc1\u4e66\uff08\u5982VPS\u6216\u4e91\u4e3b\u673a\uff0c\u4ee5\u53ca\u90e8\u5206\u865a\u62df\u4e3b\u673a\uff09<\/p>\n<p>\u867d\u7136DiscuzX3.2\u5df2\u7ecf\u9488\u5bf9https\u505a\u4e86\u4f18\u5316\uff0c\u4f46\u4ecd\u6709\u5f88\u591a\u5730\u65b9\u9700\u8981\u6539\u52a8\uff0c\u7ecf\u8fc7\u5728\u51e0\u4e2a\u751f\u4ea7\u73af\u5883\u7684\u6539\u9020\u4e2d\u53d1\u73b0\uff0cDiscuz\u76ee\u524d\u53ef\u4ee5\u5b8c\u7f8e\u652f\u6301https\u5e76\u663e\u793a\u7eff\u8272https\u56fe\u6807\uff0c\u4e0d\u8fc7\u6709\u4e9b\u9ebb\u70e6\uff0c\u4e14\u6bcf\u4e2a\u73af\u5883\u90fd\u4f1a\u51fa\u73b0\u81ea\u5df1\u7684\u95ee\u9898\u3002<\/p>\n<p>\u7b2c\u4e00\u6b65\uff1a<br \/>\n\u5168\u5c40 > \u7ad9\u70b9\u4fe1\u606f > \u7f51\u7ad9 URL\uff0c\u4fee\u6539\u4e3ahttps:\/\/bolg.yibadao.net\/\u7684\u683c\u5f0f<\/p>\n<p>\u7b2c\u4e8c\u6b65\uff1a\u4fee\u6210Discuz\u9002\u914dhttps<br \/>\n\u5982\u679c\u4f60\u7684Web\u670d\u52a1\u662fApache\uff0c\u8bf7\u5ffd\u7565\u8fd9\u4e00\u6b65\uff0cNginx\u8bf7\u7ee7\u7eed\u770b\uff1a<br \/>\nDiscuz\u5224\u65ad\u7f51\u7ad9\u662f\u5426\u542f\u52a8SSL\u662f\u91c7\u7528 $_SERVER[\u2018HTTPS\u2019] \u7684\u65b9\u5f0f\uff0c\u6b64\u65b9\u6cd5\u4e0d\u652f\u6301Nginx\uff08nginx+php-fpm\uff09\uff0c\u9700\u8981\u5148\u505a\u4e00\u4e9b\u4fee\u6539\uff0c\u8ba9Discuz\u4f7f\u7528 $_SERVER[\u2018SERVER_PORT\u2019]\u6765\u5224\u65ad\u7f51\u7ad9\u662f\u5426\u542f\u7528SSL\u3002<!--more--><br \/>\nsource\/class\/discuz\/discuz_application.php\uff08\u7ea6\u7b2c187\u884c\u5904\uff09\uff1a<br \/>\n\u67e5\u627e\uff1a<br \/>\n<code>$_G['isHTTPS'] = ($_SERVER['HTTPS'] &amp;&amp; strtolower($_SERVER['HTTPS']) != 'off') ? true : false;<\/code><br \/>\n\u4fee\u6539\u4e3a\uff1a<br \/>\n<code>$_G['isHTTPS'] = ($_SERVER['SERVER_PORT'] == 443 || $_SERVER['HTTPS'] &amp;&amp; strtolower($_SERVER['HTTPS']) != 'off') ? true : false;<\/code><br \/>\nuc_server\/avatar.php \uff08\u7ea6\u7b2c13\u884c\u5904\uff09\uff1a<\/p>\n<p>\u67e5\u627e\uff1a<br \/>\n<code>define('UC_API', strtolower(($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').':\/\/'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '\/'))));<\/code><br \/>\n\u4fee\u6539\u4e3a\uff1a<br \/>\n<code>define('UC_API', strtolower(($_SERVER['SERVER_PORT'] == 443 || $_SERVER['HTTPS'] == 'on' ? 'https' : 'http').':\/\/'.$_SERVER['HTTP_HOST'].substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '\/'))));<\/code><\/p>\n<p>\u7b2c\u4e09\u6b65\uff1aUcenter\u901a\u4fe1\u4f7f\u7528https\u65b9\u5f0f<br \/>\n\u540e\u53f0 > \u7ad9\u957f > UCenter\u8bbe\u7f6e > UCenter \u8bbf\u95ee\u5730\u5740\uff0c\u4fee\u6539\u4e3ahttps\u5f00\u5934\u7684<br \/>\nUCenter\u540e\u53f0 > \u5e94\u7528\u7ba1\u7406 > \u5e94\u7528\u7684\u4e3bURL\uff0c\u4fee\u6539\u4e3ahttps\u5f00\u5934\u3002<\/p>\n<p>\u7b2c\u4e94\u6b65\uff1a\u89e3\u51b3\u6d4f\u89c8\u5668\u63d0\u793a\u201c\u52a0\u8f7d\u4e0d\u5b89\u5168\u7684\u811a\u672c\u201d<br \/>\n\u8fd9\u4e2a\u63d0\u793a\u662f\u56e0\u4e3a\u8fd9\u4e2a\u811a\u672c\u4f7f\u7528http\u65b9\u5f0f\u52a0\u8f7d\u7684\u539f\u56e0\uff1a<script src=\u201dhttp:\/\/discuz.gtimg.cn\/cloud\/scripts\/discuz_tips.js?v=1\u2033 type=\u201dtext\/javascript\u201d charset=\u201dUTF-8\u2033><\/script>\uff0c\u6b64\u811a\u672c\u7684\u529f\u80fd\u662f\u68c0\u67e5\u8865\u4e01\u548c\u5b89\u5168\u901a\u77e5\uff0c\u7528\u5904\u4e0d\u5927\uff0c\u679c\u65ad\u5220\u9664\u3002<br \/>\n\u5220\u9664\u65b9\u6cd5\uff1a\u7f16\u8f91\u6a21\u677f\u7684footer.htm\uff0c\u5728\u6700\u540e\u627e\u5230\u5e76\u5220\u6389\uff1a< !\u2013{eval output();}\u2013>\u5373\u53ef\u3002<\/p>\n<p>\u7b2c\u516d\u6b65\uff1a\u89e3\u51b3QQ\u4e92\u8054\u7684\u95ee\u9898<br \/>\n\u9996\u5148\u5347\u7ea7QQ\u4e92\u8054\u63d2\u4ef6\uff0c\u6700\u4f4e\u7248\u672c\u8981\u6c42\u662f 1.18.2\uff0c\u5982\u679c\u5347\u7ea7\u540e\u4f9d\u7136\u4e0d\u884c\uff0c\u9700\u8981\u4fee\u6539\u56de\u8c03 URL \u4e3a\u975e HTTPS \u7684\uff1a<br \/>\n\u627e\u5230\uff1a<br \/>\nsource\/plugin\/qqconnect\/connect.class.php \u5927\u7ea641\u884c<br \/>\n\u5728common_base() \u51fd\u6570\u91cc\u9762\uff0c\u5c06 $_G[\u2018siteurl\u2019] \u76f4\u63a5\u786c\u7f16\u7801\u4e3a \u4f60\u7684http\u7684URL \uff0c\u9996\u5148\u4fee\u6539callback_url\uff0c\u5982\u679c\u4e0d\u884c\uff0c\u5c06\u6240\u6709\u5305\u542bconnect.php \u7684 URL \u5168\u90e8\u66ff\u6362\u3002<\/p>\n<p>\u7b2c\u4e03\u6b65\uff1a\u5c06\u8bba\u575b\u5e16\u5b50\u4e2d\u7f51\u7ad9\u7684URL\u6539\u6210https\u683c\u5f0f\u7684\u3002<br \/>\n\u4f1a\u5458\u5728\u53d1\u5e16\u7684\u8fc7\u7a0b\u4e2d\uff0c\u5f88\u53ef\u80fd\u8c03\u7528\u4e86\u672c\u7ad9\u522b\u5904\u7684\u5e16\u5b50\u6216\u8fde\u63a5\uff0c\u800c\u8fd9\u4e2a\u94fe\u63a5\u80af\u5b9a\u662fhttp\u7684\uff0c\u6240\u4ee5\u9700\u8981\u5c06\u8fd9\u4e9b\u94fe\u63a5\u5168\u90e8\u4fee\u6539\u6210https\u683c\u5f0f\u7684\uff1a<br \/>\n\u6267\u884cSQL\u8bed\u53e5\uff0c\u53ef\u4ee5\u5728DZ\u540e\u53f0\uff0c\u6216\u8005phpmyadmin\u4e2d\u90fd\u53ef\u4ee5\uff1a<br \/>\n1<br \/>\nUPDATE pre_forum_post SET message=REPLACE(message,\u2019http:\/\/\u65e7\u7f51\u5740.com\u2019,\u2019https:\/\/\u65b0\u7f51\u5740.com\u2019);<br \/>\n\u6700\u540e\uff0cNginx\u5f00\u542f\u5f3a\u5236https\u8df3\u8f6c\uff0c\u5728nginx\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u5728Server\u5b57\u6bb5\u589e\u52a0\uff1a<br \/>\n<code>if ($server_port = 80) {<br \/>\nreturn 301 https:\/\/$server_name$request_uri;<br \/>\n}<br \/>\nif ($scheme = http) {<br \/>\nreturn 301 https:\/\/$server_name$request_uri;<br \/>\n}<\/code><br \/>\n\u6ce8\u610f\uff1a\u8fd9\u91cc\u9700\u8981\u6839\u636e\u81ea\u5df1\u7684\u670d\u52a1\u5668\u73af\u5883\u914d\u7f6e\uff0c\u4e0d\u6b63\u786e\u6216\u8005\u6709\u95ee\u9898\u7684\u914d\u7f6e\u53ef\u80fd\u5bfc\u81f4Ucenter\u901a\u4fe1\u5931\u8d25\uff0cApache\u9700\u8981\u5728.htaccess\u4e2d\u6dfb\u52a0\u89c4\u5219\u3002<\/p>\n<p>\u5230\u6b64\uff0c\u4f60\u5e94\u8be5\u53ef\u4ee5\u770b\u5230\u7eff\u8272\u7684https\u6807\u5fd7\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u63d0\uff1a\u5df2\u7ecf\u62e5\u6709\u57df\u540d\u8bc1\u4e66\uff0c\u4e14\u670d\u52a1\u5668\u652f\u6301\u6dfb\u52a0SSL\u8bc1\u4e66\uff08\u5982VPS\u6216\u4e91\u4e3b\u673a\uff0c\u4ee5\u53ca\u90e8\u5206\u865a\u62df\u4e3b\u673a\uff09 \u867d\u7136DiscuzX3 <a href='https:\/\/www.icocean.com\/blog\/?p=4588' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[44,1756,1757,3651],"class_list":["post-4588","post","type-post","status-publish","format-standard","hentry","category-lamp","tag-discuz","tag-https","tag-ssl","tag-3651","category-24-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4588","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4588"}],"version-history":[{"count":1,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4588\/revisions"}],"predecessor-version":[{"id":4589,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4588\/revisions\/4589"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4588"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4588"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4588"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}