{"id":14992,"date":"2024-01-08T17:06:28","date_gmt":"2024-01-08T09:06:28","guid":{"rendered":"https:\/\/www.yimenyun.cn\/emen\/?p=14992"},"modified":"2024-01-08T17:06:28","modified_gmt":"2024-01-08T09:06:28","slug":"%e5%b0%8f%e7%a8%8b%e5%ba%8f%e5%a6%82%e4%bd%95%e7%94%b3%e8%af%b7ssl%e8%af%81%e4%b9%a6%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.yimenyun.cn\/emen\/14992\/","title":{"rendered":"\u5c0f\u7a0b\u5e8f\u5982\u4f55\u7533\u8bf7ssl\u8bc1\u4e66\uff1f"},"content":{"rendered":"

SSL\u8bc1\u4e66\u662f\u4e00\u79cd\u6570\u5b57\u8bc1\u4e66\uff0c\u7528\u4e8e\u52a0\u5bc6\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u4e0e\u7528\u6237\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u6027\u3002\u5c0f\u7a0b\u5e8f\u4e5f\u9700\u8981\u4f7f\u7528SSL\u8bc1\u4e66\u6765\u4fdd\u62a4\u7528\u6237\u9690\u79c1\u548c\u6570\u636e\u5b89\u5168\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u7533\u8bf7SSL\u8bc1\u4e66\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u3002<\/p>\n

\u4e00\u3001SSL\u8bc1\u4e66\u7684\u539f\u7406<\/p>\n

SSL\u8bc1\u4e66\u662f\u7531CA\u673a\u6784\u9881\u53d1\u7684\uff0c\u5176\u539f\u7406\u662f\u4f7f\u7528\u975e\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\uff0c\u5373\u516c\u94a5\u52a0\u5bc6\u548c\u79c1\u94a5\u89e3\u5bc6\u3002\u670d\u52a1\u5668\u751f\u6210\u4e00\u5bf9\u516c\u94a5\u548c\u79c1\u94a5\uff0c\u5c06\u516c\u94a5\u53d1\u9001\u7ed9CA\u673a\u6784\uff0c\u7531CA\u673a\u6784\u4f7f\u7528\u81ea\u5df1\u7684\u79c1\u94a5\u5bf9\u670d\u52a1\u5668\u7684\u516c\u94a5\u8fdb\u884c\u6570\u5b57\u7b7e\u540d\uff0c\u751f\u6210SSL\u8bc1\u4e66\u3002\u5f53\u7528\u6237\u8bbf\u95ee\u670d\u52a1\u5668\u65f6\uff0c\u670d\u52a1\u5668\u5c06SSL\u8bc1\u4e66\u53d1\u9001\u7ed9\u7528\u6237\uff0c\u7528\u6237\u7684\u6d4f\u89c8\u5668\u4f7f\u7528CA\u673a\u6784\u7684\u516c\u94a5\u5bf9SSL\u8bc1\u4e66\u8fdb\u884c\u9a8c\u8bc1\uff0c\u786e\u4fdd\u8bc1\u4e66\u7684\u771f\u5b9e\u6027\uff0c\u7136\u540e\u4f7f\u7528\u670d\u52a1\u5668\u7684\u516c\u94a5\u5bf9\u6570\u636e\u8fdb\u884c\u52a0\u5bc6\uff0c\u786e\u4fdd\u6570\u636e\u7684\u5b89\u5168\u4f20\u8f93\u3002<\/p>\n

\u4e8c\u3001\u5c0f\u7a0b\u5e8f\u7533\u8bf7SSL\u8bc1\u4e66\u7684\u6b65\u9aa4<\/p>\n

1.\u8d2d\u4e70\u57df\u540d\u548c\u670d\u52a1\u5668<\/p>\n

\u9996\u5148\u9700\u8981\u8d2d\u4e70\u4e00\u4e2a\u57df\u540d\u548c\u670d\u52a1\u5668\uff0c\u53ef\u4ee5\u9009\u62e9\u81ea\u5df1\u642d\u5efa\u670d\u52a1\u5668\u6216\u8005\u8d2d\u4e70\u4e91\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u963f\u91cc\u4e91\u6216\u817e\u8baf\u4e91\u7b49\u4e91\u670d\u52a1\u5546\u3002<\/p>\n

2.\u751f\u6210CSR\u6587\u4ef6<\/p>\n

CSR\u6587\u4ef6\u662f\u8bc1\u4e66\u7b7e\u540d\u8bf7\u6c42\u6587\u4ef6\uff0c\u9700\u8981\u5728\u670d\u52a1\u5668\u4e0a\u751f\u6210\uff0c\u53ef\u4ee5\u4f7f\u7528openssl\u547d\u4ee4\u751f\u6210\u3002\u5728\u7ec8\u7aef\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n

“`<\/p>\n

openssl req -newkey rsa:2048 -nodes -keyout yourdomain.key -out yourdomain.csr<\/p>\n

“`<\/p>\n

\u5176\u4e2dyourdomain\u662f\u4f60\u7684\u57df\u540d\uff0c\u751f\u6210\u7684yourdomain.key\u662f\u79c1\u94a5\u6587\u4ef6\uff0cyourdomain.csr\u662fCSR\u6587\u4ef6\u3002<\/p>\n

3.\u7533\u8bf7SSL\u8bc1\u4e66<\/p>\n

\u5c06CSR\u6587\u4ef6\u63d0\u4ea4\u7ed9CA\u673a\u6784\u8fdb\u884c\u8bc1\u4e66\u7533\u8bf7\uff0c\u53ef\u4ee5\u9009\u62e9\u56fd\u5185\u7684CA\u673a\u6784\u5982\u817e\u8baf\u4e91\u3001\u963f\u91cc\u4e91\u3001\u767e\u5ea6\u4e91\u7b49\uff0c\u4e5f\u53ef\u4ee5\u9009\u62e9\u56fd\u5916\u7684CA\u673a\u6784\u5982Symantec\u3001Comodo\u3001GeoTrust\u7b49\u3002\u6839\u636eCA\u673a\u6784\u7684\u8981\u6c42\u586b\u5199\u76f8\u5173\u4fe1\u606f\uff0c\u7b49\u5f85CA\u673a\u6784\u5ba1\u6838\u901a\u8fc7\u5e76\u9881\u53d1SSL\u8bc1\u4e66\u3002<\/p>\n

4.\u5b89\u88c5SSL\u8bc1\u57df\u540d\u914d\u7f6ehttps\u64cd\u4f5c\u6b65\u9aa4<\/a>\u4e66<\/p>\n

\u5c06\u9881\u53d1\u7684SSL\u8bc1\u4e66\u4e0b\u8f7d\u5e76\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e0a\uff0c\u4e00\u822c\u5305\u62ec.crt\u548c.key\u4e24\u4e2a\u6587\u4ef6\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5c06\u8bc1\u4e66\u548c\u79c1\u94a5\u6587\u4ef6\u590d\u5236\u5230\u670d\u52a1\u5668\u4e0a\uff1a<\/p>\n

“`<\/p>\n

cp yourdomain.crt \/etc\/nginx\/ssl\/<\/p>\n

cp yourdomain.key \/etc\/nginx\/ssl\/<\/p>\n

“`<\/p>\n

\u5176\u4e2d\/etc\/nginx\/ssl\/\u662f\u5b58\u653eSSL\u8bc1\u4e66\u7684\u76ee\u5f55\u3002<\/p>\n

5.\u914d\u7f6e\u670d\u52a1\u5668<\/p>\n

\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u5f00nginx\u7684\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n

“`<\/p>\n

vi \/etc\/nginx\/nginx.conf<\/p>\n

“`<\/p>\n

\u5728http\u6a21\u5757\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

“`<\/p>\n

server {<\/p>\n

listen 443 ssl;<\/p>\n

server_name yourdomain.com;<\/p>\n

ssl_certificate \/etc\/nginx\/ssl\/yourdomain.crt;<\/p>\n

ssl_certificate_key \/etc\/nginx\/ssl\/yourdomain.key;<\/p>\n

ssl_session_timeout 5m;<\/p>\n

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;<\/p>\n

ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;<\/p>\n

ssl_prefer_server_ciphers on;<\/p>\n

location \/ {<\/p>\n

proxy_pass http:\/\/localhost:8080; # \u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230\u5c0f\u7a0b\u5e8f\u540e\u53f0\u670d\u52a1<\/p>\n

proxy_set_header Host $host;<\/p>\n

proxy_set_header X-Real-IP $remote_addr;<\/p>\n

\n

<\/figure>\n<\/p>\n

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n

}<\/p>\n

}<\/p>\n

“`<\/p>\n

\u5176\u4e2dyourdomain.com\u662f\u4f60\u7684\u57df\u540d\uff0c\u5c06\u8bf7\u6c42\u8f6c\u53d1\u5230\u5c0f\u7a0b\u5e8f\u540e\u53f0\u670d\u52a1\u7684\u7aef\u53e3\u4e3a8080\u3002<\/p>\n

6.\u91cd\u542f\u670d\u52a1\u5668<\/p>\n

\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u91cd\u542fnginx\u670d\u52a1\u5668\uff1a<\/p>\n

“`<\/p>\n

nginx -s reload<\/p>\n

“`<\/p>\n

\u73b0\u5728\uff0c\u4f60\u7684\u5c0f\u7a0b\u5e8f\u5df2\u7ecf\u4f7f\u7528SSL\u8bc1\u4e66\u4fdd\u62a4\u7528\u6237\u6570\u636e\u7684\u5b89\u5168\u4f20\u8f93\u4e86\u3002<\/p>\n

\u603b\u7ed3\uff1a<\/p>\n

\u5c0f\u7a0b\u5e8f\u7533\u8bf7SSL\u8bc1\u4e66\u7684\u6b65\u9aa4\u5305\u62ec\u8d2d\u4e70\u57df\u540d\u548c\u670d\u52a1\u5668\u3001\u751f\u6210CSR\u6587\u4ef6\u3001\u7533\u8bf7SSL\u8bc1\u4e66\u3001\u5b89\u88c5SSL\u8bc1\u4e66\u3001\u914d\u7f6e\u670d\u52a1\u5668\u548c\u91cd\u542f\u670d\u52a1\u5668\u3002SSL\u8bc1\u4e66\u7684\u539f\u7406\u662f\u4f7f\u7528\u975e\u5bf9\u79f0\u52a0\u5bc6\u7b97\u6cd5\uff0c\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u4f20\u8f93\u3002SSL\u8bc1\u4e66\u7684\u4f7f\u7528\u53ef\u4ee5\u4fdd\u62a4\u7528\u6237\u9690\u79c1\u548c\u6570\u636e\u5b89\u5168\uff0c\u662f\u5c0f\u7a0b\u5e8f\u5f00\u53d1\u4e2d\u4e0d\u53ef\u6216\u7f3a\u7684\u4e00\u90e8\u5206\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

SSL\u8bc1\u4e66\u662f\u4e00\u79cd\u6570\u5b57\u8bc1\u4e66\uff0c\u7528\u4e8e\u52a0\u5bc6\u7f51\u7ad9\u548c\u5e94\u7528\u7a0b\u5e8f\u4e0e\u7528\u6237\u4e4b\u95f4\u7684\u6570\u636e\u4f20\u8f93\uff0c\u4fdd\u8bc1\u6570\u636e\u7684\u5b89\u5168\u6027\u3002\u5c0f\u7a0b\u5e8f\u4e5f\u9700\u8981\u4f7f\u7528SSL\u8bc1\u4e66\u6765\u4fdd\u62a4\u7528\u6237\u9690\u79c1\u548c\u6570\u636e\u5b89\u5168\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5c0f\u7a0b\u5e8f\u7533\u8bf7SSL\u8bc1\u4e66\u7684\u539f\u7406\u548c\u8be6\u7ec6\u6b65\u9aa4\u3002\u4e00\u3001SSL<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[19055,18647,467,510,30],"topic":[],"class_list":{"0":"post-14992","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"hentry","6":"category-sqssl","7":"tag-https","9":"tag-467","10":"tag-510","11":"tag-30"},"_links":{"self":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/14992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/comments?post=14992"}],"version-history":[{"count":1,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/14992\/revisions"}],"predecessor-version":[{"id":15029,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/posts\/14992\/revisions\/15029"}],"wp:attachment":[{"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/media?parent=14992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/categories?post=14992"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/tags?post=14992"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.yimenyun.cn\/emen\/wp-json\/wp\/v2\/topic?post=14992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}