{"id":1168,"date":"2014-10-21T16:52:46","date_gmt":"2014-10-21T08:52:46","guid":{"rendered":"https:\/\/cowmanchiang.me\/wp\/?p=1168"},"modified":"2023-10-31T15:44:49","modified_gmt":"2023-10-31T07:44:49","slug":"nginx-ssl-enable","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1168","title":{"rendered":"Nginx SSL Enable"},"content":{"rendered":"<p>\u74b0\u5883: Ubuntu 14.04 x64<\/p>\n<ol>\n<li>\u7522\u751fkey<\/li>\n<\/ol>\n<pre lang=\"bash\">\nroot@Wordpress:\/tmp# 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<p>2.\u7522\u751f csr<\/p>\n<pre lang=\"bash\">\nroot@Wordpress:\/tmp# openssl req -new -key site.key -out site.csr\nEnter pass phrase for site.key:\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) [AU]:TW\nState or Province Name (full name) [Some-State]:Taiwan\nLocality Name (eg, city) []:Taipei City\nOrganization Name (eg, company) [Internet Widgits Pty Ltd]:Cowman\nOrganizational Unit Name (eg, section) []:IT\nCommon Name (e.g. server FQDN or YOUR name) []: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 []:\nAn optional company name []:\n<\/pre>\n<ol>\n<li>cat csr\uff0c\u8cbc\u81f3\u7533\u8acb\u8655<\/li>\n<\/ol>\n<pre lang=\"bash\">\nroot@Wordpress:\/tmp# cat site.csr \n-----BEGIN CERTIFICATE REQUEST-----\nMIIC1DCCAbwCAQAwgY4xCzAJBgNVBAYTAlRXMQ8wDQYDVQQIDAZUYW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\u4e0b\u9762\u56db\u500b\u6a94\u6848<br \/>\n\u4f3a\u670d\u5668\u985e\u578b\u9078nginx<br \/>\nAddTrustExternalCARoot.crt<br \/>\nCOMODORSAAddTrustCA.crt<br \/>\nCOMODORSADomainValidationSecureServerCA.crt<br \/>\ncowman_ip.crt<\/p>\n<\/li>\n<li>\n<p>\u7522\u751f ssl-bundle.crt<\/p>\n<\/li>\n<\/ol>\n<pre lang=\"bash\">\ncat cowman_ip.crt COMODORSAAddTrustCA.crt COMODORSADomainValidationSecureServerCA.crt AddTrustExternalCARoot.crt >> ssl-bundle.crt\n<\/pre>\n<ol>\n<li>\u79fb\u9664\u9700\u8981\u8f38\u5165 phase \u7684\u6a5f\u5236<\/li>\n<\/ol>\n<pre lang=\"bash\">\nroot@Wordpress:\/tmp# openssl rsa -in site.key -out site-nopass.key\nEnter pass phrase for site.key:\nwriting RSA key\n<\/pre>\n<ol>\n<li>\u4fee\u6539 nginx \u8a2d\u5b9a\u6a94\uff0c\u4f4d\u7f6e\u5728 \/etc\/nginx\/sites-enabled\/default\uff0c\u9019\u88e1\u628a\u8a2d\u5b9a\u6a94\u6574\u4f75\u5728server\u4e2d<\/li>\n<\/ol>\n<pre lang=\"bash\">\nroot@Wordpress:\/tmp# vim \/etc\/nginx\/sites-enabled\/default\n\nserver {\n        #listen 80 default_server;\n        #listen [::]:80 default_server ipv6only=on;\n        listen 80;\n        listen 443 default ssl;\n\n        ssl_certificate \/opt\/local\/nginx\/conf\/certs\/ssl-bundle.crt;\n        ssl_certificate_key \/opt\/local\/nginx\/conf\/certs\/site_ip.key;\n\n        ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;\n        ssl_ciphers \"HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES\";\n        ssl_prefer_server_ciphers on;\n<\/pre>\n<ol>\n<li>\u91cd\u65b0\u555f\u52d5 nginx<\/li>\n<\/ol>\n<pre lang=\"bash\">\nservice nginx restart\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u74b0\u5883: Ubuntu 14.04 x64 \u7522\u751fkey root@Wordpress:\/tmp# 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;&#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: 2.\u7522\u751f csr &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1168\">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":[64,78,82],"tags":[],"class_list":["post-1168","post","type-post","status-publish","format-standard","hentry","category-nginx","category-ssl","category-ubuntu"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1168","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=1168"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1168\/revisions"}],"predecessor-version":[{"id":1994,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1168\/revisions\/1994"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}