{"id":199,"date":"2018-08-21T19:54:39","date_gmt":"2018-08-21T11:54:39","guid":{"rendered":"http:\/\/unama.space\/?p=199"},"modified":"2020-04-18T02:15:35","modified_gmt":"2020-04-17T18:15:35","slug":"ssl-certificate-for-your-website","status":"publish","type":"post","link":"https:\/\/unama.website\/?p=199","title":{"rendered":"SSL Certificate for Your Website"},"content":{"rendered":"<p>\u60f3\u5beb\u9019\u7bc7\u6587\u7ae0\u5df2\u7d93\u5f88\u4e45\u4e86\uff0c\u4f46\u662f\u6bcf\u6b21\u66f4\u65b0SSL Certificate\u6642\uff0c\u6709\u6642\u5019\u90fd\u8981\u7b49\u500b\u5e7e\u5c0f\u6642\u7684\u9a57\u8b49\uff0c\u5c31\u4e00\u76f4\u62d6&#8230;<\/p>\n<p>\u4e00\u5e74\u66f4\u65b0\u4e00\u6b21\uff0c\u6211\u5927\u6982\u4e5f\u62d6\u4e86\u5169\u6b21\u4e86\u5427&#8230;\u54c8\u54c8&#8230;<\/p>\n<p><strong>Step 1.<\/strong> \u53bb<a href=\"https:\/\/www.gandi.net\/zh-hant\">gandi.net<\/a>\u7684\u5b98\u7db2\uff0c\u81ea\u884c\u8a3b\u518a\uff0c\u9019\u908a\u5c31\u4e0d\u591a\u52a0\u8aaa\u660e\u4e86\u3002<\/p>\n<p><strong>Step 2.<\/strong> \u767b\u5165\u5f8c\uff0c\u9ede\u9078\u5de6\u908a\u9078\u55ae\uff0c\u9078SSL\u6191\u8b49\uff0c\u53f3\u908a\u9ede\u8cfc\u8cb7\u3002<\/p>\n<p>\u9019\u908a\u7684\u524d\u63d0\u662f\u4f60\u5df2\u7d93\u64c1\u6709domain name\uff0c\u8cfc\u8cb7\u57df\u540d\u8aaa\u660e\u53ef\u4ee5\u53c3\u8003<a href=\"https:\/\/unama.website\/?p=274\">\u9019\u88e1<\/a>\u3002<\/p>\n<p>\u7562\u7adfgandi.net\u7684\u65b0\u7db2\u7ad9\u8a2d\u8a08\u5f97\u6bd4\u4ee5\u524d\u597d\u61c2\u5f88\u591a&#8230;<\/p>\n<p><strong>Step 3.<\/strong> \u4ed6\u6703\u554f\u4f60SSL Certificate\u8981\u653e\u5728\u4f55\u8655\uff0c\u9ede\u5176\u4ed6\u4e3b\u6a5f\u3002<\/p>\n<p><strong>Step 4.<\/strong> \u5982\u679c\u53ea\u662f\u505ablog\u7528\uff0c\u9078\u6a19\u6e96\u6191\u8b49\u5c31\u53ef\u4ee5\u4e86\uff0c\u9078\u4fdd\u8b77\u55ae\u4e00\u4f4d\u5740\u3002<\/p>\n<p><strong>Step 5.<\/strong> \u63a5\u8457\u6211\u5011\u8981\u7522\u751fCSR\u6a94\uff0c\u8acb\u958b\u555f\u4f60\u8981\u653eSSL\u6191\u8b49\u7684\u4e3b\u6a5fcommand line\u3002<\/p>\n<p>\u8f38\u5165:<\/p>\n<pre class=\"lang:sh range:1 decode:true\">openssl req -nodes -newkey rsa:2048 -sha256 -keyout myserver.key -out server.csr<\/pre>\n<p>\u4ed6\u6703\u554f\u4f60\u4e00\u4e9b\u8cc7\u8a0a:<\/p>\n<pre class=\"lang:sh range:1-9 decode:true \">Country Name (2 letter code) [AU]: TW\nState or Province Name (full name) [Some-State]: Taiwan\nLocality Name (eg, city) []: Taipei\nOrganization Name (eg, company) [Internet Widgits Pty Ltd]: MyCompany Inc.\nOrganizational Unit Name (eg, section) []: IT\nCommon Name (eg, YOUR name) []: yourdomain.com\nEmail Address []: youremail@gmail.com\nA challenge password []: \u53ef\u4e0d\u586b\nAn optional company name []: \u53ef\u4e0d\u586b<\/pre>\n<p>\u7136\u5f8c\u4f60\u6703\u770b\u5230\u7522\u751f\u7684\u5169\u500b\u6a94\u6848:&nbsp;myserver.key, server.csr<\/p>\n<p><strong>Step 6.<\/strong> copy \u4f60\u7684CSR\u5167\u5bb9\u8cbc\u5230gandi.net\u7684\u9801\u9762\u4e0a<\/p>\n<pre class=\"lang:sh range:1 decode:true \">cat server.csr<\/pre>\n<p>\u53efcat\u5f8c\u8907\u88fd<\/p>\n<p>\u6ce8\u610f\u9019\u908a\u8981\u78ba\u8a8d<strong>\u7c3d\u5c6c\u540d\u7a31\u8207\u4f60\u8981\u4fdd\u8b77\u7684\u57df\u540d\u76f8\u540c<\/strong><\/p>\n<p><strong>Step 7.<\/strong> \u9019\u908a\u5efa\u8b70\u4f60\u7684\u57df\u540d\u662f\u5728gandi.net\u4e00\u8d77\u8cb7\u7684\uff0c\u9019\u6a23\u9a57\u8b49\u65b9\u6cd5\u5c31\u53ef\u4ee5\u81ea\u52d5\u8df3\u904e\u3002<\/p>\n<p><strong>Step 8.<\/strong> \u52a0\u5165\u8cfc\u7269\u8eca<\/p>\n<p><strong>Step 9.<\/strong> \u4ed6\u6703\u8981\u4f60\u586b\u4e00\u4e0b\u767c\u7968\u8cc7\u8a0a\uff0c\u53ef\u4ee5\u7528\u4e2d\u6587\u3002<\/p>\n<p><strong>Step 10.<\/strong>&nbsp; \u4e00\u6b21\u8cb7\u5169\u5e74\u6703\u6bd4\u8f03\u4fbf\u5b9c\uff0c\u6211\u76ee\u524d\u770b\u5230\u4e00\u5e74\u662fNT.410\uff0c\u5169\u5e74NT.690\u3002\u4e0d\u904e\u9084\u8981\u52a05%\u52a0\u503c\u7a05\u3002<\/p>\n<p><strong>Step 11.<\/strong> \u4ed8\u6b3e\u4e0d\u7528\u6211\u591a\u8aaa\u4e86\uff0c\u7adf\u7136\u53ef\u4ee5\u7528\u6bd4\u7279\u5e63\u4ed8\uff0c\u9019\u5bb6\u516c\u53f8\u771f\u7684\u5f88\u6f6e~ \u4e0d\u6127\u662fNoBullshit~<\/p>\n<p><strong>Step 12.<\/strong> \u6211\u662f\u7528\u4fe1\u7528\u5361\u4ed8\u6b3e\uff0c\u4e4b\u5f8c\u4ed6\u6703\u986f\u793a\u8a02\u55ae\u8655\u7406\u4e2d\uff0c\u6703\u5728\u5b8c\u6210\u5f8c\u5bc4\u78ba\u8a8d\u4fe1\u7d66\u4f60\u3002<\/p>\n<p><strong>Step 13.<\/strong> \u6536\u5230\u78ba\u8a8d\u4fe1\u5f8c\uff0c\u53ef\u76f4\u63a5\u9ede\u78ba\u8a8d\u4fe1\u4e2d\u7684\u9023\u7d50\uff0c\u6703\u5e36\u4f60\u5230\u6191\u8b49\u9a57\u8b49\u7a0b\u5e8f\u7684\u9801\u9762\u3002<\/p>\n<p><strong>Step 14.<\/strong> \u5982\u679c\u4f60\u76ee\u524d\u7684\u7a0b\u5e8f\u662f\u5361\u5728\u57df\u540d\u6240\u6709\u6b0a\u9a57\u8b49\uff0c\u90a3\u4fbf\u53ef\u4ee5\u958b\u59cb\u4e0b\u4e00\u6b65\u52d5\u4f5c\uff0c\u9ede\u9078\u65c1\u908a\u7684\u7de8\u8f2f\u5716\u6848\u3002<\/p>\n<p><strong>Step 15.<\/strong> \u6211\u5efa\u8b70\u7528\u6a94\u6848\u9a57\u8b49\uff0c\u56e0\u70ba\u9a57\u8b49\u7684\u6700\u5feb\u3002<\/p>\n<p><strong>Step 16.<\/strong> \u78ba\u8a8d\u5f8c\uff0c\u8981\u4e0b\u8f09\u4ed6\u7d66\u7684\u6a94\u6848\u4e26\u653e\u5230\u4e3b\u6a5f\u4e2d\u4ed6\u6307\u5b9a\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u4f60\u53ef\u4ee5\u9ede\u9078\u6a94\u6848\u7684\u7db2\u5740\uff0c\u770b\u662f\u5426\u80fd\u770b\u5230\u6a94\u6848\u5167\u5bb9\uff0c\u5c31\u77e5\u9053\u4ed6\u80fd\u4e0d\u80fd\u9a57\u8b49\u5f97\u5230\u6a94\u6848\u3002<\/p>\n<p><strong>Step 17. <\/strong>\u7528\u6a94\u6848\u9a57\u8b49\u771f\u7684\u8d85\u5feb&#8230;\u6211\u5927\u6982\u53ea\u7b49\u4e8610\u5206\u9418\u4e0d\u5230\uff0c\u5c31\u6536\u5230\u9a57\u8b49\u6210\u529f\u7684\u78ba\u8a8d\u4fe1\u3002(\u6211\u4e4b\u524d\u662f\u7528\u6536email\u65b9\u5f0f\uff0c\u4f46\u7b49\u534a\u5929\u90fd\u6c92\u6536\u5230\u3002)<\/p>\n<p><strong>Step 18.<\/strong> \u53ef\u7e7c\u7e8c\u9ede\u78ba\u8a8d\u4fe1\u4e2d\u7684\u9023\u7d50\uff0c\u4e0b\u8f09yourdomain.com.crt\u548c\u4e2d\u7e7c\u6191\u8b49(.pem)<\/p>\n<p><strong>Step 19.<\/strong> \u628a.pem\u52a0\u5728yourdomain.com.crt\u5f8c\u9762<\/p>\n<pre class=\"lang:sh range:1 decode:true \">cat GandiStandardSSLCA2.pem &gt;&gt; yourdomain.com.crt<\/pre>\n<p><strong>Step 20.<\/strong> \u63a5\u4e0b\u4f86\u8981\u53bb\u7de8\u8f2f\u4f3a\u670d\u5668\u7684\u8a2d\u5b9a\u6a94\uff0c\u6211\u81ea\u5df1\u7528\u7684\u662fNginx<\/p>\n<p>\u6211\u7684\u8a2d\u5b9a\u6a94\u653e\u5728<code>\/etc\/nginx\/conf.d\/default.conf<\/code><\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh range:1-6 decode:true\">server {\n    ...\n    ssl_certificate     \/etc\/nginx\/ssl\/yourdomain.com.crt\n    ssl_certificate_key \/etc\/nginx\/ssl\/myserver.key\n    ...\n}<\/pre>\n<p><strong>Step 21.<\/strong> \u6aa2\u67e5\u8a2d\u5b9a\u6a94\u662f\u5426\u6709\u932f\u4e26\u91cd\u65b0\u8f09\u5165\u8a2d\u5b9a\u6a94<\/p>\n<pre class=\"lang:sh range:1-2 decode:true \">sudo nginx -t\nsudo systemctl reload nginx.service<\/pre>\n<p>\u5c31\u53ef\u4ee5\u53bbhttps:\/\/yourdomain.com\u770b\u770b\u662f\u5426\u6210\u529f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u60f3\u5beb\u9019\u7bc7\u6587\u7ae0\u5df2\u7d93\u5f88\u4e45\u4e86\uff0c\u4f46\u662f\u6bcf\u6b21\u66f4\u65b0SSL Certificate\u6642\uff0c\u6709\u6642\u5019\u90fd\u8981\u7b49\u500b\u5e7e\u5c0f\u6642\u7684\u9a57\u8b49\uff0c\u5c31\u4e00\u76f4\u62d6&#8230; \u4e00\u5e74\u66f4\u65b0\u4e00\u6b21\uff0c\u6211\u5927\u6982\u4e5f\u62d6\u4e86\u5169\u6b21\u4e86\u5427&#038;#&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/unama.website\/?p=199\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,5],"tags":[],"_links":{"self":[{"href":"https:\/\/unama.website\/index.php?rest_route=\/wp\/v2\/posts\/199"}],"collection":[{"href":"https:\/\/unama.website\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unama.website\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unama.website\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unama.website\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199"}],"version-history":[{"count":9,"href":"https:\/\/unama.website\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":364,"href":"https:\/\/unama.website\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions\/364"}],"wp:attachment":[{"href":"https:\/\/unama.website\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unama.website\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unama.website\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}