{"id":153,"date":"2014-07-02T03:33:00","date_gmt":"2014-07-01T19:33:00","guid":{"rendered":"https:\/\/neidi.homeip.net\/blog\/cblog\/?p=153"},"modified":"2022-11-29T23:18:14","modified_gmt":"2022-11-29T15:18:14","slug":"%e5%95%9f%e5%8b%95-windows-%e7%89%88-apache-%e7%9a%84-https-ssl-%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/neidi.homeip.net\/blog\/cblog\/?p=153","title":{"rendered":"\u555f\u52d5 Windows \u7248 Apache \u7684 HTTPS (SSL) \u529f\u80fd"},"content":{"rendered":"<p>\u771f\u7684\u662f\u597d\u4e45\u6c92\u5728 Blog \u4e2d PO \u6587\u4e86<br \/>\n\u525b\u597d\u6700\u8fd1\u5728\u5617\u8a66\u958b\u555f Apache \u7684 HTTPS (SSL) \u529f\u80fd\uff0c\u6240\u4ee5\u5c31\u9806\u624b\u5728 Blog \u4e2d\u505a\u500b\u7d00\u9304~<\/p>\n<p>\u6b65\u9a5f\u5927\u6982\u5206\u70ba\u4e0b\u5217<\/p>\n<ul>\n<li>\u5efa\u7acb\u6191\u8b49<\/li>\n<li>\u4fee\u6539 Apache \u7684 httpd.conf \u6a94<\/li>\n<li>\u4fee\u6539 Apache \u7684 httpd-ssl.conf \u6a94<\/li>\n<\/ul>\n<p><!--more--><\/p>\n<p><span class=\"bbcode-size-5\">1. \u5efa\u7acb\u6191\u8b49<\/span><br \/>\n\u9996\u5148\u4e00\u958b\u59cb\u5373\u662f\u9700\u8981\u5efa\u7acb\u6191\u8b49\uff0c\u5927\u6982\u9700\u8981\u4e0b\u9762\u5e7e\u500b\u6307\u4ee4<\/p>\n<ol>\n<li><code>openssl genrsa -des3 -out server.key 2048<\/code><\/li>\n<li><code>openssl req -new -key server.key -out server.csr[*]openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt<\/code><\/li>\n<li><code>openssl rsa -in server.key.org -out server.key[\/list]<\/code><\/li>\n<\/ol>\n<p>\u800c Windows \u7248 Apache \u88e1\u9762\u901a\u5e38\u9644\u6709 OpenSSL\uff0c\u4ee5\u6211\u7684\u74b0\u5883\u4f86\u8aaa\uff0c\u5728 Windows 7 \u4e0b\u5b89\u88dd\u597d Apache \u4e4b\u5f8c\uff0cOpenSSL \u9810\u8a2d\u8def\u5f91\u5373\u70ba Apache \u5b89\u88dd\u8def\u5f91\u5e95\u4e0b\u7684 bin \u8cc7\u6599\u593e\u4e2d\u7684 openssl.exe\uff0c\u8981\u505a\u7684\u5c31\u662f\u900f\u904e\u5167\u9644\u7684 OpenSSL \u4f86\u7522\u751f\u6191\u8b49\u3002<\/p>\n<p>\u53e6\u5916\u7531\u65bc Apache \u5167\u9644\u7684 OpenSSL\uff0c\u5176 config \u6a94\u6848\u662f\u53e6\u5916\u653e\u5728 Apache \u88e1 conf \u8cc7\u6599\u593e\u4e0b\u7684 openssl.cnf\uff0c\u56e0\u6b64\u5728\u57f7\u884c\u4e0a\u9762\u7684\u6307\u4ee4\u6642\u5047\u5982\u6709\u51fa\u73fe\u627e\u4e0d\u5230 config \u6a94\u6848\u7684\u8a71\uff0c\u9700\u8981\u5728\u6307\u4ee4\u88e1\u591a\u52a0\u53c3\u6578 -config &#8220;Apache \u5b89\u88dd\u8def\u5f91\\conf\\openssl.cnf&#8221;<\/p>\n<p>\u7576\u7136\u5982\u679c\u5148\u5c07\u547d\u4ee4\u63d0\u793a\u5b57\u5143\u5207\u63db\u81f3 Apache \u5b89\u88dd\u8def\u5f91\u5f8c\u518d\u57f7\u884c\u6307\u4ee4\u7684\u8a71\uff0c\u5c31\u53ef\u4ee5\u907f\u514d\u6bcf\u6b21\u8981\u8f09\u5165 config \u6a94\u6848\u90fd\u8981\u6253\u90a3\u4e00\u9577\u4e32\u7684 &#8220;Apache \u5b89\u88dd\u8def\u5f91&#8221;<\/p>\n<p>\u63a5\u8457\u5c31\u662f\u958b\u555f Windows \u5167\u5efa\u7684\u547d\u4ee4\u63d0\u793a\u5b57\u5143\uff0c\u4e26\u5207\u63db\u5230 Apache \u7684\u5b89\u88dd\u8def\u5f91\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/neidi.homeip.net\/files\/20140702\/20140702-1.png\"><\/p>\n<p>\u7136\u5f8c\u4f9d\u5e8f\u8f38\u5165\u6307\u4ee4<\/p>\n<p><span class=\"bbcode-size-4\"><span style=\"color: red;\">openssl genrsa -des3 -out server.key 2048<\/span><\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/neidi.homeip.net\/files\/20140702\/20140702-2.png\"><\/p>\n<p><span class=\"bbcode-size-4\"><span style=\"color: red;\">openssl req -new -key server.key -out server.csr<\/span><\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/neidi.homeip.net\/files\/20140702\/20140702-3.png\"><\/p>\n<p>\u8f38\u5165\u6191\u8b49\u76f8\u95dc\u8cc7\u8a0a , \u5982\uff1aCountry Name=TW , State Name=Taiwan , Organization Name=neidi , Common Name=neidi.homeip.net (Hostname)\uff0c\u5176\u4ed6\u53ef\u4ee5\u4e0d\u7528\u586b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/neidi.homeip.net\/files\/20140702\/20140702-4.png\"><\/p>\n<p><span class=\"bbcode-size-4\"><span style=\"color: red;\">openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt<\/span><\/span><br \/>\n<img decoding=\"async\" src=\"https:\/\/neidi.homeip.net\/files\/20140702\/20140702-5.png\"><\/p>\n<p><span class=\"bbcode-size-4\"><span style=\"color: red;\">openssl rsa -in server.key.org -out server.key<\/span><\/span><br \/>\n\u6b64\u6b65\u9a5f\u70ba\u79fb\u9664\u79c1\u5bc6\u91d1\u9470\u4e2d\u7684\u5bc6\u78bc\uff0c\u800c\u5f9e\u79c1\u5bc6\u91d1\u9470\u4e2d\u6458\u9664\u5bc6\u78bc\u7684\u539f\u56e0\u662f\uff1aApache win32 \u7248\u672c\u4e0d\u652f\u63f4 Passphrase \u7684\u529f\u80fd\u3002<br \/>\n\u6545\u5148\u5c07\u539f\u672c\u7684 server.key \u6539\u540d\u70ba server.key.org\uff0c\u518d\u57f7\u884c\u9019\u500b\u6307\u4ee4<br \/>\n<img decoding=\"async\" src=\"https:\/\/neidi.homeip.net\/files\/20140702\/20140702-6.png\"><\/p>\n<p>\u6700\u5f8c\u5c07\u4e0a\u9762\u7522\u751f\u7684 server.key \u8ddf server.crt \uff0c\u5c31\u76f4\u63a5\u64fa\u5230 &#8220;Apache \u5b89\u88dd\u8def\u5f91\\conf&#8221; \u5373\u53ef\uff08Apache\u9810\u8a2d\u7684\u6191\u8b49\u653e\u7f6e\u4f4d\u7f6e\uff09<\/p>\n<p><span class=\"bbcode-size-5\">2. \u4fee\u6539 Apache \u7684 httpd.conf \u6a94<\/span><br \/>\n\u5c07 httpd.conf \u4e2d &#8220;LoadModule ssl_module modules\/mod_ssl.so&#8221; \u524d\u9762\u7684\u8a3b\u89e3\u53d6\u6d88<br \/>\n\u63a5\u8457\u5c07 &#8220;Include conf\/extra\/httpd-ssl.conf&#8221; \u7684\u8a3b\u89e3\u4e5f\u53d6\u6d88\u6389<\/p>\n<p><span class=\"bbcode-size-5\">3.\u4fee\u6539 Apache \u7684 httpd-ssl.conf \u6a94<\/span><br \/>\n\u5c07 &#8220;Apache \u5b89\u88dd\u8def\u5f91\\conf\\extra\\httpd-ssl.conf \u6a94 &#8220;\u4e2d\u7684\u76f8\u95dc\u8a2d\u5b9a\u8f38\u5165<br \/>\n\u5982<\/p>\n<blockquote><p><code><br \/>\n&lt;VirtualHost *:443&gt;<\/code><\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>DocumentRoot &#8220;C:\/Apache2.2\/htdocs&#8221;<br \/>\nServerName neidi.homeip.net:443<br \/>\nServerAdmin<br \/>\nErrorLog &#8220;logs\/neidi.homeip.net_https-error.log&#8221;<br \/>\nTransferLog &#8220;logs\/neidi.homeip.net_https-access.log&#8221;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>SSLEngine on<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>SSLProtocol all -SSLv2<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>SSLCertificateFile &#8220;C:\/Apache2.2\/conf\/server.crt&#8221;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>SSLCertificateKeyFile &#8220;C:\/Apache2.2\/conf\/server.key&#8221;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>&lt;FilesMatch &#8220;\\.(cgi|shtml|phtml|php)$&#8221;&gt;<br \/>\nSSLOptions +StdEnvVars<br \/>\n&lt;\/FilesMatch&gt;<br \/>\n&lt;Directory &#8220;C:\/Apache2.2\/cgi-bin&#8221;&gt;<br \/>\nSSLOptions +StdEnvVars<br \/>\n&lt;\/Directory&gt;<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>BrowserMatch &#8220;MSIE [2-5]&#8221; \\<br \/>\nnokeepalive ssl-unclean-shutdown \\<br \/>\ndowngrade-1.0 force-response-1.0<\/p>\n<p><code><code><\/code><\/code><\/p>\n<p>CustomLog &#8220;C:\/Apache2.2\/logs\/ssl_request.log&#8221; \\<br \/>\n&#8220;%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \\&#8221;%r\\&#8221; %b&#8221;<\/p>\n<p><code><br \/>\n<\/code><\/p>\n<p><code>&lt;\/VirtualHost&gt;   <\/code><\/p><\/blockquote>\n<p>\u6700\u5f8c\u91cd\u65b0\u555f\u52d5 Apache \u5373\u53ef\u641e\u5b9a\u56c9\uff01<\/p>\n<p>\u8cc7\u6599\u53c3\u8003\uff1a<br \/>\n<a href=\"http:\/\/blog.changyy.org\/2009\/05\/windows-apache-with-https-ssl-windows-xp.html\">[Windows] \u5b89\u88dd Apache with HTTPS (SSL) \u3001\u5efa\u7acb\u6191\u8b49 @ Windows XP<\/a><br \/>\n<a href=\"http:\/\/chiangchingchi.pixnet.net\/blog\/post\/44718239-apache-2.2.17-%E5%95%9F%E7%94%A8-ssl\">Apache 2.2.17 \u555f\u7528 SSL<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u771f\u7684\u662f\u597d\u4e45\u6c92\u5728 Blog \u4e2d PO \u6587\u4e86 \u525b\u597d\u6700\u8fd1\u5728\u5617\u8a66\u958b\u555f Apache \u7684 HTTPS (SSL) \u529f\u80fd\uff0c&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-153","post","type-post","status-publish","format-standard","hentry","category-4"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=\/wp\/v2\/posts\/153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=153"}],"version-history":[{"count":3,"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions"}],"predecessor-version":[{"id":199,"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=\/wp\/v2\/posts\/153\/revisions\/199"}],"wp:attachment":[{"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/neidi.homeip.net\/blog\/cblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}