{"id":617,"date":"2014-07-27T09:00:16","date_gmt":"2014-07-27T01:00:16","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=617"},"modified":"2016-07-15T17:29:56","modified_gmt":"2016-07-15T09:29:56","slug":"%e8%ae%a9centos%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%94%af%e6%8c%81https%ef%bc%88%e5%ae%89%e5%85%a8http%e5%8d%8f%e8%ae%ae","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/centos\/2014\/07\/27\/090016617.html","title":{"rendered":"\u8ba9CentOS\u670d\u52a1\u5668\u652f\u6301https\uff08\u5b89\u5168http\u534f\u8bae)"},"content":{"rendered":"<p><strong>1\u3001\u5b89\u88c5mod_ssl<\/strong><\/p>\n<p>\u901a\u8fc7yum\u6765\u5728\u7ebf\u5b89\u88c5mod_ssl<br \/>\n[root@Crayfish home]# <span style=\"color: #ff0000;\">yum -y install mod_ssl <\/span>? ???\u2190 \u5728\u7ebf\u5b89\u88c5mod_ssl<br \/>\n<i><span style=\"color: #c0c0c0;\">Loaded plugins: security<br \/>\nbase? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 3.7 kB? ???00:00<br \/>\nepel? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 4.4 kB? ???00:00<br \/>\nextras? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???| 3.4 kB? ???00:00<br \/>\nupdates? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 3.4 kB? ???00:00<br \/>\nSetting up Install Process<br \/>\nResolving Dependencies<br \/>\n&#8211;&gt; Running transaction check<br \/>\n&#8212;&gt; Package mod_ssl.x86_64 1:2.2.15-31.el6.centos will be installed<br \/>\n&#8211;&gt; Finished Dependency Resolution<\/span><\/i><\/p>\n<p>Dependencies Resolved<\/p>\n<p>====================================================================================================<br \/>\nPackage? ?? ?? ?? ?Arch? ?? ?? ?? ???Version? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?Repository? ?? ?? ? Size<br \/>\n====================================================================================================<br \/>\nInstalling:<br \/>\nmod_ssl? ?? ?? ?? ?x86_64? ?? ?? ?? ?1:2.2.15-31.el6.centos? ?? ?? ?? ?? ?updates? ?? ?? ?? ? 91 k<\/p>\n<p>Transaction Summary<br \/>\n====================================================================================================<br \/>\nInstall? ?? ? 1 Package(s)<!--more--><\/p>\n<p>Total download size: 91 k<br \/>\nInstalled size: 183 k<br \/>\nDownloading Packages:<br \/>\nmod_ssl-2.2.15-31.el6.centos.x86_64.rpm? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???|??91 kB? ???00:00<br \/>\nRunning rpm_check_debug<br \/>\nRunning Transaction Test<br \/>\nTransaction Test Succeeded<br \/>\nRunning Transaction<br \/>\nInstalling : 1:mod_ssl-2.2.15-31.el6.centos.x86_64? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???1\/1<br \/>\nVerifying??: 1:mod_ssl-2.2.15-31.el6.centos.x86_64? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???1\/1<\/p>\n<p>Installed:<br \/>\nmod_ssl.x86_64 1:2.2.15-31.el6.centos<\/p>\n<p>Complete!<\/p>\n<p><strong>2\u3001HTTP \u670d\u52a1\u5668\u4e0a\u914d\u7f6emod_ssl<\/strong><\/p>\n<p><strong>[1] \u5efa\u7acb\u670d\u52a1\u5668\u5bc6\u94a5<\/strong><\/p>\n<p>[root@Crayfish home]#??<span style=\"color: #ff0000;\">cd \/etc\/pki\/tls\/certs\/<\/span>\u3000 \u2190 \u8fdb\u5165HTTP\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6\u6240\u5728\u76ee\u5f55<br \/>\n[root@Crayfish certs]#??<span style=\"color: #ff0000;\">make server.key<\/span>\u3000 \u2190 \u5efa\u7acb\u670d\u52a1\u5668\u5bc6\u94a5<span style=\"color: #c0c0c0;\"><i>umask 77 ; \\<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>? ?? ???\/usr\/bin\/openssl genrsa -aes128 2048 &gt; server.key<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>Generating RSA private key, 2048 bit long modulus<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.+++<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;+++<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>e is 65537 (0x10001)<\/i><\/span><br \/>\nEnter pass phrase:\u3000? ?? ?? ?? ?? ?? ?? ?\u2190 \u5728\u8fd9\u91cc\u8f93\u5165\u53e3\u4ee4<br \/>\nVerifying &#8211; Enter pass phrase:\u3000??\u2190 \u786e\u8ba4\u53e3\u4ee4\uff0c\u518d\u6b21\u8f93\u5165<br \/>\n[root@Crayfish certs]# openssl rsa -in server.key -out server.key \u3000 \u2190 \u4ece\u5bc6\u94a5\u4e2d\u5220\u9664\u5bc6\u7801\uff08\u4ee5\u907f\u514d\u7cfb\u7edf\u542f\u52a8\u540e\u88ab\u8be2\u95ee\u53e3\u4ee4\uff09<br \/>\nEnter pass phrase for server.key:\u3000 \u2190 \u8f93\u5165\u53e3\u4ee4<br \/>\n<i><span style=\"color: #c0c0c0;\">writing RSA key<\/span><\/i><\/p>\n<p><strong>[2] \u5efa\u7acb\u670d\u52a1\u5668\u516c\u94a5<\/strong><\/p>\n<p>[root@Crayfish certs]# <span style=\"color: #ff0000;\">make server.csr<\/span>\u3000 \u2190 \u5efa\u7acb\u670d\u52a1\u5668\u5bc6\u94a5<br \/>\n<i><span style=\"color: #c0c0c0;\">umask 77 ; \\<br \/>\n\/usr\/bin\/openssl req -utf8 -new -key server.key -out server.csr<br \/>\nYou are about to be asked to enter information that will be incorporated<br \/>\ninto your certificate request.<br \/>\nWhat you are about to enter is what is called a Distinguished Name or a DN.<br \/>\nThere are quite a few fields but you can leave some blank<br \/>\nFor some fields there will be a default value,<br \/>\nIf you enter &#8216;.&#8217;, the field will be left blank.<br \/>\n&#8212;&#8211;<br \/>\n<\/span><\/i>Country Name (2 letter code) [XX]:<span style=\"color: #ff0000;\">CN<\/span>\u3000 \u2190 \u8f93\u5165\u56fd\u540d<br \/>\nState or Province Name (full name) []:<span style=\"color: #ff0000;\">HuNan<\/span>\u3000 \u2190 \u8f93\u5165\u7701\u540d<br \/>\nLocality Name (eg, city) [Default City]:<span style=\"color: #ff0000;\">ChangSha<\/span>\u3000 \u2190 \u8f93\u5165\u57ce\u5e02\u540d<br \/>\nOrganization Name (eg, company) [Default Company Ltd]:www.example.com\u3000 \u2190 \u8f93\u5165\u7ec4\u7ec7\u540d\uff08\u4efb\u610f\uff09<br \/>\nOrganizational Unit Name (eg, section) []:\u3000 \u2190 \u4e0d\u8f93\u5165\uff0c\u76f4\u63a5\u56de\u8f66<br \/>\nCommon Name (eg, your name or your server&#8217;s hostname) []:<span style=\"color: #ff0000;\">www.example.com<\/span>\u3000 \u2190 \u8f93\u5165\u901a\u79f0\uff08\u4efb\u610f\uff09<br \/>\nEmail Address []:<span style=\"color: #ff0000;\">example@abc.com<\/span> \u3000 \u2190 \u8f93\u5165\u7535\u5b50\u90ae\u7bb1\u5730\u5740<\/p>\n<p><span style=\"color: #c0c0c0;\"><i>Please enter the following &#8216;extra&#8217; attributes<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>to be sent with your certificate request<\/i><\/span><\/p>\n<p>A challenge password []:\u3000 \u2190 \u4e0d\u8f93\u5165\uff0c\u76f4\u63a5\u56de\u8f66<br \/>\nAn optional company name []: \u3000 \u2190 \u4e0d\u8f93\u5165\uff0c\u76f4\u63a5\u56de\u8f66<\/p>\n<p><strong>[3] \u5efa\u7acb\u670d\u52a1\u5668\u8bc1\u4e66<\/strong><\/p>\n<p>[root@Crayfish certs]#??<span style=\"color: #ff0000;\">openssl x509 -in server.csr -out server.pem -req -signkey server.key -days 365<\/span>\u3000 \u2190 \u5efa\u7acb\u670d\u52a1\u5668\u8bc1\u4e66<\/p>\n<p><i><span style=\"color: #c0c0c0;\">Signature ok<br \/>\nsubject=\/C=CN\/ST=HuNan\/L=ChangSha\/O=www.example.com\/CN=www.example.com\/emailAddress=example@abc.com<br \/>\nGetting Private key<\/span><\/i><i><span style=\"color: #c0c0c0;\">Signature ok<br \/>\n<\/span><\/i><br \/>\n[root@Crayfish certs]#??<span style=\"color: #ff0000;\">chmod 400 server.*<\/span>? ? \u2190 \u4fee\u6539\u6743\u9650\u4e3a400<\/p>\n<p><strong>[4] \u8bbe\u7f6eSSL<\/strong><\/p>\n<p>[root@Crayfish certs]#??<span style=\"color: #ff0000;\">vi \/etc\/httpd\/conf.d\/ssl.conf<\/span>\u3000 \u2190 \u4fee\u6539SSL\u7684\u8bbe\u7f6e\u6587\u4ef6<br \/>\n#DocumentRoot &#8220;\/var\/www\/html&#8221;\u3000 \u2190 \u627e\u5230\u8fd9\u4e00\u884c\uff0c\u5c06\u884c\u9996\u7684\u201c#\u201d\u53bb\u6389<br \/>\n<span style=\"color: #2e8b57;\">DocumentRoot &#8220;\/var\/www\/html&#8221;<\/span>\u3000 \u2190 \u53d8\u4e3a\u6b64\u72b6\u6001<\/p>\n<p><strong>[5] \u91cd\u65b0\u542f\u52a8HTTP\u670d\u52a1\uff0c\u8ba9SSL\u751f\u6548<\/strong><br \/>\n[root@Crayfish certs]# <span style=\"color: #ff0000;\">service httpd restart<\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>Stopping httpd:? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???[??OK??]<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>Starting httpd: httpd: apr_sockaddr_info_get() failed for Crayfish<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>httpd: Could not reliably determine the server&#8217;s fully qualified domain name, using 127.0.0.1 for ServerName<\/i><\/span><br \/>\n<span style=\"color: #c0c0c0;\"><i>? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ???[??OK??]<\/i><\/span><br \/>\n[root@Crayfish conf.d]#<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u5b89\u88c5mod_ssl \u901a\u8fc7yum\u6765\u5728\u7ebf\u5b89\u88c5mod_ssl [root@Crayfish home]# yum -y install mod_ssl ? ???\u2190 \u5728\u7ebf\u5b89\u88c5mod_ssl Loaded plugins: security base? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ? | 3.7 kB? ???00:00 epel? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21],"tags":[7],"class_list":["post-617","post","type-post","status-publish","format-standard","hentry","category-centos","tag-apache"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=617"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/617\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}