{"id":2068,"date":"2022-12-09T16:14:07","date_gmt":"2022-12-09T08:14:07","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=2068"},"modified":"2022-12-09T16:14:07","modified_gmt":"2022-12-09T08:14:07","slug":"%e5%88%a9%e7%94%a8nginx%e7%9a%84%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e8%bf%9b%e8%a1%8c%e7%ab%af%e5%8f%a3%e8%bd%ac%e5%8f%91","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/article\/2022\/12\/09\/1614072068.html","title":{"rendered":"\u5229\u7528Nginx\u7684\u53cd\u5411\u4ee3\u7406\u8fdb\u884c\u7aef\u53e3\u8f6c\u53d1"},"content":{"rendered":"<blockquote><p>\n  Nginx\u662f\u4e00\u6b3e\u975e\u5e38\u4f18\u79c0\u7684web\u670d\u52a1\u5668\uff0c\u4ed6\u63d0\u4f9b\u4e86\u975e\u5e38\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u914d\u7f6e\u7b80\u5355\uff0c\u6027\u80fd\u5f3a\u52b2\u7b49\u7b49\u3002<br \/>\n  \u6211\u4eec\u5728\u5c06\u5176\u7528\u505aweb\u670d\u52a1\u5668\u7684\u540c\u65f6\uff0c\u8fd8\u5e38\u5e38\u4f1a\u7528\u5230\u5176\u53cd\u5411\u4ee3\u7406\u7684\u529f\u80fd\uff0c\u4f46\u5927\u591a\u6570\u573a\u666f\u90fd\u662f\u57fa\u4e8e\u670d\u52a1\u7684\uff0c\u5373\u5e94\u7528\u5c42\u4ee3\u7406<br \/>\n  \u5176\u5b9e\u4ed6\u8fd8\u53ef\u4ee5\u5728\u56db\u5c42\u8fdb\u884c\u8f6c\u53d1\uff0c\u5373tcp\u6216udp\u8f6c\u53d1\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801\n<\/p><\/blockquote>\n<h2>Nginx\u6a21\u5757<\/h2>\n<ul>\n<li>ngx_stream_ssl_module<\/li>\n<\/ul>\n<h2>\u914d\u7f6e\u793a\u4f8b<\/h2>\n<pre><code class=\"language-conf line-numbers\">stream {\n  # \u4e0d\u540c\u7684\u57df\u540d\u8fdb\u6765\uff0c\u6620\u5c04\u5230\u4e0d\u540c\u7684\u76ee\u6807\n  map $ssl_preread_server_name $name {\n    playnice.eigenmagic.net playnice_backend;\n    webification.eigenmagic.net webification_backend;\n    project-eschatron.eigenmagic.net eschatron_backend;\n  }\n\n  upstream playnice_backend {\n    server 10.10.1.11:443;\n  }\n\n  upstream webification_backend {\n    server 10.10.1.101:8443;\n  }\n\n  upstream eschatron_backend {\n    server 10.10.1.201:443;\n  }\n\n  server {\n    listen 443;\n    proxy_pass $name;\n    proxy_protocol on;\n    ssl_preread on;\n  }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Nginx\u662f\u4e00\u6b3e\u975e\u5e38\u4f18\u79c0\u7684web\u670d\u52a1\u5668\uff0c\u4ed6\u63d0\u4f9b\u4e86\u975e\u5e38\u5f3a\u5927\u7684\u529f\u80fd\uff0c\u914d\u7f6e\u7b80\u5355\uff0c\u6027\u80fd\u5f3a\u52b2\u7b49\u7b49\u3002 \u6211\u4eec\u5728\u5c06\u5176\u7528\u505aweb\u670d\u52a1\u5668\u7684\u540c\u65f6\uff0c\u8fd8\u5e38\u5e38\u4f1a\u7528\u5230\u5176\u53cd\u5411\u4ee3\u7406\u7684\u529f\u80fd\uff0c\u4f46\u5927\u591a\u6570\u573a\u666f\u90fd\u662f\u57fa\u4e8e\u670d\u52a1\u7684\uff0c\u5373\u5e94\u7528\u5c42\u4ee3\u7406 \u5176\u5b9e\u4ed6\u8fd8\u53ef\u4ee5\u5728\u56db\u5c42\u8fdb\u884c\u8f6c\u53d1\uff0c\u5373tcp\u6216udp\u8f6c\u53d1\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\u4ee3\u7801 Nginx\u6a21\u5757 ngx_stream_ssl_module \u914d\u7f6e\u793a\u4f8b stream { # \u4e0d\u540c\u7684\u57df\u540d\u8fdb\u6765\uff0c\u6620\u5c04\u5230\u4e0d\u540c\u7684\u76ee\u6807 map $ssl_preread_server_name $name { playnice.eigenmagic.net playnice_backend; webification.eigenmagic.net webification_backend; project-eschatron.eigenmagic.net eschatron_backend; } upstream playnice_backend { server 10.10.1.11:443; } upstream webification_backend { server 10.10.1.101:8443; } upstream eschatron_backend { server 10.10.1.201:443; } server { listen 443; proxy_pass $name; proxy_protocol on; ssl_preread on; } }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[359,402],"class_list":["post-2068","post","type-post","status-publish","format-standard","hentry","category-article","tag-nginx","tag-pass_proxy"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/2068","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=2068"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/2068\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=2068"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=2068"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=2068"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}