{"id":36503,"date":"2023-06-25T07:35:26","date_gmt":"2023-05-13T17:09:53","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/"},"modified":"2024-04-30T10:35:05","modified_gmt":"2024-04-30T02:35:05","slug":"apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/","title":{"rendered":"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0"},"content":{"rendered":"<h1>\u9996\u5148<\/h1>\n<p>\u4f5c\u4e3a\u6295\u7a3f\u7684\u7ec3\u4e60\uff0c\u6211\u521b\u5efa\u4e86\u8fd9\u4e2a\u5907\u5fd8\u5f55\u6765\u8bb0\u5f55\u6211\u5728Apache\u4e0a\u4f7f\u7528SSL\u7684\u7ecf\u5386\u3002<\/p>\n<h1>\u524d\u63d0 t\u00ed)<\/h1>\n<p>CentOS 6.9 \u662f\u4e00\u79cd\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u642d\u8f7d\u4e86 Apache 2.2 \u4f5c\u4e3a\u5176\u9ed8\u8ba4\u7684\u7f51\u7edc\u670d\u52a1\u5668\u8f6f\u4ef6\u3002<\/p>\n<h1>\u5b89\u88c5openssl<\/h1>\n<pre class=\"post-pre\"><code># yum install openssl<\/code><\/pre>\n<h1>\u5b89\u88c5mod_ssl<\/h1>\n<p>\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u786e\u8ba4\u6a21\u5757\u662f\u5426\u5df2\u5b89\u88c5\u3002<\/p>\n<pre class=\"post-pre\"><code># httpd -M | grep ssl<\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code># yum install mod_ssl<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h1>\u751f\u6210\u79c1\u94a5\u548c\u8bc1\u4e66<\/h1>\n<pre class=\"post-pre\"><code># cd \/etc\/httpd\/conf<\/code><\/pre>\n<p>\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\u751f\u6210\u79c1\u94a5\u3002<\/p>\n<pre class=\"post-pre\"><code># openssl genrsa -aes128 1024 &gt; server.key<\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code># openssl req -new -key server.key &gt; server.csr\r\n\u30d1\u30b9\u30d5\u30ec\u30fc\u30ba\u3092\u5165\u529b\r\nEnter pass phrase for server.key:\r\nYou are about to be asked to enter information that will be incorporated\r\ninto your certificate request.\r\nWhat you are about to enter is what is called a Distinguished Name or a DN.\r\nThere are quite a few fields but you can leave some blank\r\nFor some fields there will be a default value,\r\n\r\nIf you enter '.', the field will be left blank.\r\n\r\n\u56fd\u30b3\u30fc\u30c9\r\nCountry Name (2 letter code) [XX]:JP\r\n\u90fd\u9053\u5e9c\u770c\r\nState or Province Name (full name) []:Tokyo\r\n\u5e02\u753a\u6751\r\nLocality Name (eg, city) [Default City]:\r\n\u7d44\u7e54\u540d\uff08\u7a7a\u767d\uff09\r\nOrganization Name (eg, company) [Default Company Ltd]:\r\n\u90e8\u9580\u540d\uff08\u7a7a\u767d\uff09\r\nOrganizational Unit Name (eg, section) []:\r\n\u30b5\u30fc\u30d0\u540d\u3001IP\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\r\nCommon Name (eg, your name or your server's hostname) []:192.168.56.254\r\n\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\uff08\u7a7a\u767d\uff09\r\nEmail Address []:\r\n\r\nPlease enter the following 'extra' attributes\r\nto be sent with your certificate request\r\n\u5225\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\uff1f\uff08\u7a7a\u767d\uff09\r\nA challenge password []:\r\n\u5225\u306e\u7d44\u7e54\u540d\uff08\u7a7a\u767d\uff09\r\nAn optional company name []:\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<pre class=\"post-pre\"><code># openssl x509 -in server.csr -days 36500 -req -signkey server.key &gt; server.crt<\/code><\/pre>\n<h1>\u5728\u542f\u52a8\u65f6\u7701\u7565\u8f93\u5165\u5bc6\u7801<\/h1>\n<pre class=\"post-pre\"><code># mv server.key server.key.bak<\/code><\/pre>\n<p>\u7528\u4ee5\u4e0b\u7684\u547d\u4ee4\u6765\u5220\u9664\u5bc6\u7801\u77ed\u8bed\u3002<\/p>\n<pre class=\"post-pre\"><code># openssl rsa -in server.key.bak &gt; server.key<\/code><\/pre>\n<h1>SSL\u914d\u7f6e\u6587\u4ef6\u7684\u7f16\u8f91<\/h1>\n<pre class=\"post-pre\"><code>vi \/etc\/httpd\/conf.d\/ssl.conf<\/code><\/pre>\n<pre class=\"post-pre\"><code>\u5143\u3042\u308b\u8a18\u8ff0\u3092\u30b3\u30e1\u30f3\u30c8\u30a2\u30a6\u30c8\u3057\u3001\u4e0b\u8a18\u3092\u8ffd\u52a0\r\n#SSLCertificateFile \/etc\/pki\/tls\/certs\/localhost.crt\r\n#SSLCertificateKeyFile \/etc\/pki\/tls\/private\/localhost.key\r\nSSLCertificateFile \/etc\/httpd\/conf\/server.crt\r\nSSLCertificateKeyFile \/etc\/httpd\/conf\/server.key\r\n<\/code><\/pre>\n<p>\u8bf7\u91cd\u65b0\u542f\u52a8 Apache \u5e76\u5b8c\u6210\u3002<br \/>\n\u4ee5\u4e0a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148 \u4f5c\u4e3a\u6295\u7a3f\u7684\u7ec3\u4e60\uff0c\u6211\u521b\u5efa\u4e86\u8fd9\u4e2a\u5907\u5fd8\u5f55\u6765\u8bb0\u5f55\u6211\u5728Apache\u4e0a\u4f7f\u7528SSL\u7684\u7ecf\u5386\u3002 \u524d\u63d0 t\u00ed) CentOS [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-36503","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Apache\u652f\u6301SSL\u7684\u7b14\u8bb0 - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/apache\u652f\u6301ssl\u7684\u7b14\u8bb0\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0\" \/>\n<meta property=\"og:description\" content=\"\u9996\u5148 \u4f5c\u4e3a\u6295\u7a3f\u7684\u7ec3\u4e60\uff0c\u6211\u521b\u5efa\u4e86\u8fd9\u4e2a\u5907\u5fd8\u5f55\u6765\u8bb0\u5f55\u6211\u5728Apache\u4e0a\u4f7f\u7528SSL\u7684\u7ecf\u5386\u3002 \u524d\u63d0 t\u00ed) CentOS [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/apache\u652f\u6301ssl\u7684\u7b14\u8bb0\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-13T17:09:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-30T02:35:05+00:00\" \/>\n<meta name=\"author\" content=\"\u6e05, \u5b87\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6e05, \u5b87\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/\",\"name\":\"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-05-13T17:09:53+00:00\",\"dateModified\":\"2024-04-30T02:35:05+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e\",\"name\":\"\u6e05, \u5b87\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g\",\"caption\":\"\u6e05, \u5b87\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0 - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/apache\u652f\u6301ssl\u7684\u7b14\u8bb0\/","og_locale":"zh_CN","og_type":"article","og_title":"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0","og_description":"\u9996\u5148 \u4f5c\u4e3a\u6295\u7a3f\u7684\u7ec3\u4e60\uff0c\u6211\u521b\u5efa\u4e86\u8fd9\u4e2a\u5907\u5fd8\u5f55\u6765\u8bb0\u5f55\u6211\u5728Apache\u4e0a\u4f7f\u7528SSL\u7684\u7ecf\u5386\u3002 \u524d\u63d0 t\u00ed) CentOS [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/apache\u652f\u6301ssl\u7684\u7b14\u8bb0\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-05-13T17:09:53+00:00","article_modified_time":"2024-04-30T02:35:05+00:00","author":"\u6e05, \u5b87","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6e05, \u5b87","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/","name":"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-05-13T17:09:53+00:00","dateModified":"2024-04-30T02:35:05+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"Apache\u652f\u6301SSL\u7684\u7b14\u8bb0"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/1a6ecd3d914d22a5ac32791ffc1fbd8e","name":"\u6e05, \u5b87","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b2016c18459a605fc469c7566608f5686491baa112d0871ee613f61b7210565?s=96&d=mm&r=g","caption":"\u6e05, \u5b87"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/qingyu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/apache%e6%94%af%e6%8c%81ssl%e7%9a%84%e7%ac%94%e8%ae%b0\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/36503","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=36503"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/36503\/revisions"}],"predecessor-version":[{"id":91389,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/36503\/revisions\/91389"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=36503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=36503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=36503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}