{"id":1166,"date":"2014-10-21T16:32:12","date_gmt":"2014-10-21T08:32:12","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1166"},"modified":"2023-10-31T15:44:50","modified_gmt":"2023-10-31T07:44:50","slug":"apache-ssl-enable","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1166","title":{"rendered":"Apache SSL Enable"},"content":{"rendered":"<p>\u74b0\u5883 CentOS 5.x i386<\/p>\n<ol>\n<li>\u7522\u751f key<\/li>\n<\/ol>\n<pre lang=\"bash\">\n[root@Web test]# openssl genrsa -des3 -out site.key 2048\nGenerating RSA private key, 2048 bit long modulus\n............+++\n..................+++\ne is 65537 (0x10001)\nEnter pass phrase for site.key:\nVerifying - Enter pass phrase for site.key:\n<\/pre>\n<ol>\n<li>\u7522\u751f csr<\/li>\n<\/ol>\n<pre lang=\"bash\">\n[root@Web test]# openssl req -new -key site.key -out site.csr\nEnter pass phrase for site.key: #\u8f38\u5165\u525b\u525b\u7522\u751fkey\u6642\u8f38\u5165\u7684\u8cc7\u8a0a\nYou are about to be asked to enter information that will be incorporated\ninto your certificate request.\nWhat you are about to enter is what is called a Distinguished Name or a DN.\nThere are quite a few fields but you can leave some blank\nFor some fields there will be a default value,\nIf you enter '.', the field will be left blank.\n-----\nCountry Name (2 letter code) [GB]:TW\nState or Province Name (full name) [Berkshire]:Taiwan\nLocality Name (eg, city) [Newbury]:Taipei City\nOrganization Name (eg, company) [My Company Ltd]:Cowman\nOrganizational Unit Name (eg, section) []:IT\nCommon Name (eg, your name or your server's hostname) []:Cowman.ip\nEmail Address []:cowman.chiang@gmail.com\n\nPlease enter the following 'extra' attributes\nto be sent with your certificate request\nA challenge password []: #\u53ef\u4ee5\u76f4\u63a5\u6309enter\u5ffd\u7565\nAn optional company name []: #\u53ef\u4ee5\u76f4\u63a5\u6309enter\u5ffd\u7565\n<\/pre>\n<ol>\n<li>cat csr\uff0c\u5c07\u8cc7\u6599\u4e1f\u5230\u6191\u8b49\u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vkwMV0\/OWvbNREKSv3RsfjMWVsAtVwmdkRKlUNAFXMIOvAwmSImd\/\n+0ya5gEv4M+JVWWYy6vEnUOV333eR9tR4eCw7YO862TFdic9+4OPhVFpKeWJLANz\nwQ4uUOWkuPA=\n-----END CERTIFICATE REQUEST-----\n<\/pre>\n<ol>\n<li>\n<p>\u4ee5namecheap\u7684comodo\u6191\u8b49\u70ba\u4f8b\uff0c\u9078\u64c7\u4f3a\u670d\u5668\u70ba apache + mod_ssl\uff0c\u6703\u56de\u50b3\u5169\u500b\u6a94\u6848\u81f3mail\u4e2d<br \/>\ncowman_ip.ca-bundle<br \/>\ncowman_ip.crt<\/p>\n<\/li>\n<li>\n<p>\u5b89\u88ddmod_ssl<\/p>\n<\/li>\n<\/ol>\n<pre lang=\"bash\">\nyum install mod_ssl\n<\/pre>\n<ol>\n<li>\u53d6\u6d88\u9700\u8981\u8f38\u5165phase\u7684\u6a5f\u5236<\/li>\n<\/ol>\n<pre lang=\"bash\">\n[root@Web test]# openssl rsa -in site.key -out site-nopass.key\nEnter pass phrase for roamingcenter_tanet_edu_tw.key:\nwriting RSA key\n<\/pre>\n<ol>\n<li>\u7de8\u8f2f apache \u8a2d\u5b9a\u6a94\uff0c\u7bc4\u4f8b\u662f\u5728 \/etc\/httpd\/conf.d\/ssl.conf<\/li>\n<\/ol>\n<pre lang=\"bash\">\n[root@Web test]# vim \/etc\/httpd\/conf.d\/ssl.conf\n\n<VirtualHost _default_:443>\nSSLEngine on\nSSLCertificateFile \/etc\/httpd\/certs\/cowman_ip.crt\nSSLCertificateKeyFile \/etc\/httpd\/certs\/site-nopass.key\nSSLCertificateChainFile \/etc\/httpd\/certs\/cowman_ip.ca-bundle\n<\/pre>\n<ol>\n<li>\u5c07 http \u8f49\u81f3 https\uff0c\u4fee\u6539 \/etc\/httpd\/conf\/httpd.conf<\/li>\n<\/ol>\n<pre lang=\"bash\">\n[root@Web test]# vim \/etc\/httpd\/conf\/httpd.conf\n\n#\u52a0\u5728\u6700\u5f8c\u9762\nRewriteEngine On\nRewriteCond %{HTTPS} off\nRewriteRule (.*) https:\/\/%{HTTP_HOST}%{REQUEST_URI}\n<\/pre>\n<ol>\n<li>\u91cd\u65b0\u555f\u52d5 apache<\/li>\n<\/ol>\n<pre lang=\"bash\">\nservice httpd restart\n<\/pre>\n<p>!! \u8a18\u5f97\u6aa2\u67e5iptables\u9632\u706b\u7246\u8a2d\u5b9a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883 CentOS 5.x i386 \u7522\u751f key [root@Web test]# openssl genrsa -des3 -out site.key 2048 Generating RSA private key, 2048 bit long modulus &#8230;&#8230;&#8230;&#8230;+++ &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;+++ e is 65537 (0x10001) Enter pass phrase for site.key: Verifying &#8211; Enter pass phrase for site.key: &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1166\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,93,78],"tags":[],"class_list":["post-1166","post","type-post","status-publish","format-standard","hentry","category-apache","category-centos","category-ssl"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1166"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1166\/revisions"}],"predecessor-version":[{"id":1995,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1166\/revisions\/1995"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}