{"id":17,"date":"2015-08-09T16:37:30","date_gmt":"2015-08-09T08:37:30","guid":{"rendered":"http:\/\/www.tiferking.cn\/?p=17"},"modified":"2015-08-09T18:59:02","modified_gmt":"2015-08-09T10:59:02","slug":"%e5%9c%a8ubuntu%e7%8e%af%e5%a2%83%e4%b8%8b%e7%9a%84apache%e4%b8%8a%e5%ae%89%e8%a3%85ssl%e8%af%81%e4%b9%a6","status":"publish","type":"post","link":"https:\/\/www.tiferking.cn\/index.php\/2015\/08\/09\/17\/","title":{"rendered":"\u5728Ubuntu\u73af\u5883\u4e0b\u7684Apache\u4e0a\u5b89\u88c5SSL\u8bc1\u4e66"},"content":{"rendered":"<p style=\"padding-left: 30px;\">\u4e4b\u524d\u4e00\u76f4\u56f0\u6270\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u7533\u8bf7\u5230\u4e86ssl\u8bc1\u4e66\u90a3\u4e48\u5e94\u8be5\u5982\u4f55\u5e94\u7528\u5230\u7f51\u7ad9\u4e0a\uff1f<\/p>\n<p style=\"padding-left: 30px;\">\u56e0\u4e3a\u6211\u7528\u7684\u662fApache\u670d\u52a1\u5668\uff0c\u5e76\u4e14\u901a\u8fc7apt-get\u5b89\u88c5\u7684\uff0c\u4f3c\u4e4e\u8ddf\u90a3\u4e2a\u901a\u7528\u7248\u8fd8\u4e0d\u592a\u76f8\u540c\uff1f<\/p>\n<p style=\"padding-left: 30px;\">\u95f2\u8bdd\u5c11\u53d9\u3002<\/p>\n<p style=\"padding-left: 30px;\">\u4e4b\u524d\u6709\u63d0\u5230\u8fc7<a href=\"https:\/\/www.tiferking.cn\/index.php\/2015\/08\/08\/19\/\" target=\"_blank\">\u7533\u8bf7\u514d\u8d39SSL\u8bc1\u4e66<\/a>\u3002\u6211\u7528\u7684\u5c31\u662f\u8fd9\u4e2a\u8bc1\u4e66\uff0c\u4e0d\u4fe1\u70b9\u4e0a\u8fb9\u7684\u5c0f\u9501\u5b50\u81ea\u5df1\u770b\u770b\u3002\u3002\u3002<strong>\u2191_\u2191<\/strong><\/p>\n<p style=\"padding-left: 30px;\">\u9996\u5148\u6253\u5f00\u7533\u8bf7\u7684\u8bc1\u4e66\u538b\u7f29\u6587\u4ef6\uff0c\u53ef\u4ee5\u770b\u5230\u5bf9\u4e8eApache\u7248\u672c\uff0c\u6709\u8fd9\u6837\u4e09\u4e2a\u6587\u4ef6\uff1a<\/p>\n<p style=\"padding-left: 30px;\"><a href=\"https:\/\/www.tiferking.cn\/wp-content\/uploads\/2015\/08\/crt.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-28\" src=\"https:\/\/www.tiferking.cn\/wp-content\/uploads\/2015\/08\/crt.jpg\" alt=\"crt\" width=\"161\" height=\"74\" \/><\/a><\/p>\n<p style=\"padding-left: 30px;\">\u7136\u540e\u6211\u4eec\u5c06\u8fd9\u4e09\u4e2a\u6587\u4ef6\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u4f60\u53ef\u4ee5\u4e0a\u4f20\u5230\u4efb\u4f55\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u6211\u4e0a\u4f20\u5728\uff1a\/etc\/ssl<\/p>\n<p style=\"padding-left: 30px;\">\u7136\u540e\u5c31\u662f\u5c06\u5b83\u52a0\u8f7d\u5230Apache\u4e2d\u3002<\/p>\n<h3 style=\"padding-left: 30px;\"><strong>\u7b2c\u4e00\u6b65\uff1a\u6253\u5f00Apache\u7684ssl\u6a21\u5757<\/strong><\/h3>\n<p style=\"padding-left: 60px;\">\u8fd9\u4e2a\u53ea\u9700\u8981\u4e00\u6761\u547d\u4ee4\uff1a<\/p>\n<p style=\"padding-left: 60px;\"><strong><em># a2enmod ssl\u00a0<\/em><\/strong><\/p>\n<h3 style=\"padding-left: 30px;\"><strong>\u7b2c\u4e8c\u6b65\uff1a\u914d\u7f6e\u865a\u62df\u670d\u52a1\u5668<\/strong><\/h3>\n<p style=\"padding-left: 60px;\">\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\uff1a\/etc\/apache2\/sites-available\/default-ssl.conf<\/p>\n<p style=\"padding-left: 60px;\"><em>&lt;IfModule mod_ssl.c&gt;<\/em><\/p>\n<p style=\"padding-left: 90px;\"><em>&lt;VirtualHost *:443&gt;<\/em><\/p>\n<p style=\"padding-left: 120px;\"><em>ServerAdmin webmaster@localhost<\/em><br \/>\n<em>DocumentRoot \/var\/www\/html<\/em><br \/>\n<em> ServerName www.tiferking.cn<\/em><br \/>\n<em><span style=\"line-height: 1.5;\">ErrorLog ${APACHE_LOG_DIR}\/error.log<br \/>\n<\/span><span style=\"line-height: 1.5;\">CustomLog ${APACHE_LOG_DIR}\/access.log combined<\/span><\/em><\/p>\n<p style=\"padding-left: 120px;\"><em>SSLEngine on<\/em><br \/>\n<em>SSLCertificateFile \/etc\/ssl\/2_tiferking.cn.crt<\/em><br \/>\n<em> SSLCertificateKeyFile \/etc\/ssl\/3_tiferking.cn.key<\/em><br \/>\n<em> SSLCACertificateFile \/etc\/ssl\/1_root_bundle.crt<\/em><\/p>\n<p style=\"padding-left: 120px;\"><em>&lt;FilesMatch &#8220;\\.(cgi|shtml|phtml|php)$&#8221;&gt;<\/em><br \/>\n<em> SSLOptions +StdEnvVars<\/em><br \/>\n<em> &lt;\/FilesMatch&gt;<\/em><br \/>\n<em> &lt;Directory \/usr\/lib\/cgi-bin&gt;<\/em><br \/>\n<em> SSLOptions +StdEnvVars<\/em><br \/>\n<em> &lt;\/Directory&gt;<\/em><br \/>\n<em>BrowserMatch &#8220;MSIE [2-6]&#8221; \\<\/em><br \/>\n<em> nokeepalive ssl-unclean-shutdown \\<\/em><br \/>\n<em> downgrade-1.0 force-response-1.0<\/em><br \/>\n<em>BrowserMatch &#8220;MSIE [17-9]&#8221; ssl-unclean-shutdown<\/em><\/p>\n<p style=\"padding-left: 90px;\"><em>&lt;\/VirtualHost&gt;<\/em><\/p>\n<p style=\"padding-left: 60px;\"><em>&lt;\/IfModule&gt;<\/em><\/p>\n<p style=\"padding-left: 60px;\">\u53ea\u9700\u8981\u5c06\u4e0a\u8ff0\u6587\u5b57\u4e2d\u6240\u6709\u7684tiferking.cn\u6539\u6210\u4f60\u81ea\u5df1\u7684\u57df\u540d\uff0c\u7136\u540e\u518d\u5728\/etc\/apache2\/sites-enabled\u76ee\u5f55\u4e0b\u5efa\u7acb\u4e00\u4e2a\u94fe\u63a5\u5c31OK\u4e86\uff01\u4f60\u53ef\u4ee5\u901a\u8fc7\u8fd9\u6761\u547d\u4ee4\u6765\u5b8c\u6210\uff1a<\/p>\n<p style=\"padding-left: 60px;\"><strong><em># ln -s\u00a0\/etc\/apache2\/sites-available\/default-ssl.conf\u00a0\/etc\/apache2\/sites-enabled\/001-ssl.conf<\/em><\/strong><\/p>\n<p style=\"padding-left: 60px;\">\u5f53\u7136\u5047\u5982\u4f60\u5c06\u8bc1\u4e66\u6587\u4ef6\u653e\u5728\u5176\u5b83\u5730\u65b9\u5c31\u5c06<em>SSLEngine on<\/em>\u540e\u8fb9\u90a3\u51e0\u4e2a\u6587\u4ef6\u7684\u8def\u5f84\u6539\u597d\u5c31\u53ef\u4ee5\u5566~<\/p>\n<h3 style=\"padding-left: 30px;\"><strong>\u7b2c\u4e09\u6b65\uff1a\u8df3\u8f6chttp\u5230https<\/strong><\/h3>\n<p style=\"padding-left: 60px;\">\u8fd9\u4e2a\u529f\u80fd\u4e00\u822c\u662f\u901a\u8fc7.htaccess\u5b9e\u73b0\u7684\uff0c\u5c06\u4ee5\u4e0b\u4ee3\u7801\u590d\u5236\u5230\u7f51\u7ad9\u6839\u76ee\u5f55\u7684.htaccess\u6587\u4ef6\u5f53\u4e2d\uff0c\u5982\u679c\u6ca1\u6709\u7684\u8bdd\u53ef\u4ee5\u65b0\u5efa\u3002<\/p>\n<p style=\"padding-left: 90px;\"><em>RewriteEngine On<\/em><\/p>\n<p style=\"padding-left: 90px;\"><em>RewriteCond %{SERVER_PORT} 80<\/em><\/p>\n<p style=\"padding-left: 90px;\"><em>RewriteRule ^(.*)$ https:\/\/www.tiferking.cn\/$1 [R,L]<\/em><\/p>\n<p style=\"padding-left: 60px;\">\u5c06\u4e0a\u8ff0\u6587\u5b57\u4e2d\u7684tiferking.cn\u6539\u6210\u4f60\u81ea\u5df1\u7684\u57df\u540d\uff0c\u7136\u540e\u4fdd\u5b58\u3002<\/p>\n<p style=\"padding-left: 60px;\">\u518d\u6253\u5f00<strong><em>\u00a0\/etc\/apache2\/apache2.conf<\/em><\/strong><\/p>\n<p style=\"padding-left: 60px;\">\u627e\u5230\u91cc\u8fb9\u7684<\/p>\n<p style=\"padding-left: 90px;\"><em>Options FollowSymLinks <\/em><br \/>\n<em>AllowOverride None<\/em><\/p>\n<p style=\"padding-left: 60px;\">\u6539\u4e3a<\/p>\n<p style=\"padding-left: 90px;\"><em>Options FollowSymLinks <\/em><br \/>\n<em>AllowOverride All<\/em><\/p>\n<p style=\"padding-left: 60px;\">\u4fdd\u5b58\u3002<\/p>\n<p style=\"padding-left: 60px;\">\u518d\u8fd0\u884c\u4ee5\u4e0b\u4ee3\u7801\u6253\u5f00rewrite\u6a21\u5757\uff1a<\/p>\n<p style=\"padding-left: 90px;\"><strong><em># ln -s\u00a0\/etc\/apache2\/mods-available\/rewrite.load\u00a0\/etc\/apache2\/mods-enabled\/rewrite.load<\/em><\/strong><\/p>\n<h3 style=\"padding-left: 30px;\">\u7b2c\u56db\u6b65\uff1a\u91cd\u542fApache<\/h3>\n<p style=\"padding-left: 60px;\">\u8f93\u5165\u547d\u4ee4\u91cd\u542fApache\uff1a<\/p>\n<p style=\"padding-left: 90px;\"><strong><em># apache2ctl -k restart<\/em><\/strong><\/p>\n<p style=\"padding-left: 30px;\">\u81f3\u6b64\uff0c\u6240\u6709\u7684\u5de5\u4f5c\u5c31\u5b8c\u6210\u5566\uff0c\u6d4b\u8bd5\u4ee5\u4e0b\u4f60\u7684\u7f51\u7ad9\u6709\u6ca1\u6709\u7eff\u8272\u5c0f\u9501\u4e86\u5427~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e4b\u524d\u4e00\u76f4\u56f0\u6270\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u7533\u8bf7\u5230\u4e86ssl\u8bc1\u4e66\u90a3\u4e48\u5e94\u8be5\u5982\u4f55\u5e94\u7528\u5230\u7f51\u7ad9\u4e0a\uff1f \u56e0\u4e3a\u6211\u7528\u7684\u662fApache\u670d\u52a1\u5668\uff0c\u5e76\u4e14 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-ubuntu-study"],"_links":{"self":[{"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/comments?post=17"}],"version-history":[{"count":5,"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":33,"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/posts\/17\/revisions\/33"}],"wp:attachment":[{"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/media?parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/categories?post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tiferking.cn\/index.php\/wp-json\/wp\/v2\/tags?post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}