{"id":52735,"date":"2024-12-03T13:52:32","date_gmt":"2024-12-03T05:52:32","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52735\/"},"modified":"2024-12-03T13:52:32","modified_gmt":"2024-12-03T05:52:32","slug":"nginx-%e8%b7%a8%e5%9f%9f%e8%ae%be%e7%bd%ae%e5%90%8e%e8%bf%94%e5%9b%9e%e5%86%85%e5%ae%b9%e5%bc%82%e5%b8%b8%ef%bc%8c%e4%bb%a3%e7%90%86%e8%b7%af%e5%be%84%e9%85%8d%e7%bd%ae%e9%94%99%e8%af%af%e6%80%8e","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52735\/","title":{"rendered":"Nginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Nginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f<\/h1>\n<p>\u77e5\u8bc6\u70b9\u638c\u63e1\u4e86\uff0c\u8fd8\u9700\u8981\u4e0d\u65ad\u7ec3\u4e60\u624d\u80fd\u719f\u7ec3\u8fd0\u7528\u3002\u4e0b\u9762\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u5b9e\u6218\uff0c\u624b\u628a\u624b\u6559\u5927\u5bb6\u5b66\u4e60\u300aNginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f\u300b\uff0c\u5728\u5b9e\u73b0\u529f\u80fd\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5e26\u5927\u5bb6\u91cd\u65b0\u6e29\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6e29\u6545\u800c\u77e5\u65b0\uff0c\u56de\u5934\u770b\u770b\u8bf4\u4e0d\u5b9a\u53c8\u6709\u4e0d\u4e00\u6837\u7684\u611f\u609f\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241123\/173232093067411ea2de5aa.jpg\" class=\"aligncenter\" title=\"Nginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" alt=\"Nginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>nginx\u8de8\u57df\u8bbe\u7f6e\u8fd4\u56de\u9519\u8bef\u5185\u5bb9\u7684\u7591\u60d1<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5728nginx\u914d\u7f6e\u4e86\u8de8\u57df\u8bbe\u7f6e\u540e\uff0c\u524d\u7aef\u8bf7\u6c42\u8fd4\u56de\u7684\u5185\u5bb9\u4e0e\u9884\u671f\u4e0d\u4e00\u81f4\u3002\u6b63\u5e38\u60c5\u51b5\u4e0b\u5e94\u8fd4\u56de\u7279\u5b9a\u5185\u5bb9\uff0c\u4f46\u5b9e\u9645\u8fd4\u56de\u5374\u662f\u4e0d\u540c\u7684\u3002<\/p>\n<p><strong>\u89e3\u7b54\uff1a<\/strong><\/p>\n<p>\u4f60\u63d0\u5230\u7684\u60c5\u51b5\u8868\u660e\uff0c\u4f60\u5c06\u4ee3\u7406\u8def\u5f84\u9519\u8bef\u5730\u914d\u7f6e\u5230\u4e86\u4f60\u7684\u524d\u7aef\u9879\u76ee\u76ee\u5f55\u4e2d\u3002\u5e94\u8be5\u5c06\u4ee3\u7406\u8bf7\u6c42\u8f6c\u53d1\u7ed9\u540e\u7aef\u63a5\u53e3\uff0c\u800c\u4e0d\u662f\u524d\u7aef\u9875\u9762\u3002<\/p>\n<p><strong>\u6b63\u786e\u7684\u914d\u7f6e\uff1a<\/strong><\/p>\n<p>\u63d0\u4f9b\u4e00\u4e2a\u793a\u4f8b\u914d\u7f6e\u4f9b\u4f60\u53c2\u8003\uff1a<\/p>\n<pre>server {\n    listen 80;\n    server_name localhost;\n    charset utf-8;\n    location \/ {\n        root \/\u4f60\u7684\u524d\u7aef\u8def\u5f84;\n        try_files $uri $uri\/ \/index.html;\n        index index.html index.htm;\n    }\n\n    location \/api\/ {\n        proxy_set_header Host $http_host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header REMOTE-HOST $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_pass \/\u4f60\u7684\u540e\u7aef\u63a5\u53e3\u5730\u5740;\n        client_max_body_size 50m;\n    }\n}<\/pre>\n<p>\u5728\u8be5\u914d\u7f6e\u4e2d\uff1a<\/p>\n<ul>\n<li>\/ \u8def\u5f84\u6307\u5411\u4f60\u7684\u524d\u7aef\u9879\u76ee\u6839\u76ee\u5f55\u3002<\/li>\n<li>\/api\/ \u8def\u5f84\u4ee3\u7406\u8bf7\u6c42\u5230\u4f60\u7684\u540e\u7aef\u63a5\u53e3\u5730\u5740\u3002<\/li>\n<li>\u8de8\u57df\u8bbe\u7f6e\u548c\u4ee3\u7406\u5934\u5df2\u6b63\u786e\u914d\u7f6e\u3002<\/li>\n<\/ul>\n<p>\u4eca\u5929\u5e26\u5927\u5bb6\u4e86\u89e3\u4e86\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u5e0c\u671b\u5bf9\u4f60\u6709\u6240\u5e2e\u52a9\uff1b\u5173\u4e8e\u6587\u7ae0\u7684\u6280\u672f\u77e5\u8bc6\u6211\u4eec\u4f1a\u4e00\u70b9\u70b9\u6df1\u5165\u4ecb\u7ecd\uff0c\u6b22\u8fce\u5927\u5bb6\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff0c\u4e00\u8d77\u5b66\u4e60\u7f16\u7a0b~<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   Win11\u6587\u4ef6\u5939\u600e\u4e48\u8bbe\u7f6e\u5bc6\u7801 Win11\u6587\u4ef6\u5939\u52a0\u5bc6\u6559\u7a0b\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Nginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f \u77e5\u8bc6\u70b9\u638c\u63e1\u4e86\uff0c\u8fd8\u9700\u8981\u4e0d\u65ad\u7ec3\u4e60\u624d\u80fd\u719f\u7ec3\u8fd0\u7528\u3002\u4e0b\u9762\u7c73\u4e91\u7ed9\u5927\u5bb6\u5e26\u6765\u4e00\u4e2a\u6587\u7ae0\u5f00\u53d1\u5b9e\u6218\uff0c\u624b\u628a\u624b\u6559\u5927\u5bb6\u5b66\u4e60\u300aNginx \u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u5f02\u5e38\uff0c\u4ee3\u7406\u8def\u5f84\u914d\u7f6e\u9519\u8bef\u600e\u4e48\u529e\uff1f\u300b\uff0c\u5728\u5b9e\u73b0\u529f\u80fd\u7684\u8fc7\u7a0b\u4e2d\u4e5f\u5e26\u5927\u5bb6\u91cd\u65b0\u6e29\u4e60\u76f8\u5173\u77e5\u8bc6\u70b9\uff0c\u6e29\u6545\u800c\u77e5\u65b0\uff0c\u56de\u5934\u770b\u770b\u8bf4\u4e0d\u5b9a\u53c8\u6709\u4e0d\u4e00\u6837\u7684\u611f\u609f\uff01 nginx\u8de8\u57df\u8bbe\u7f6e\u8fd4\u56de\u9519\u8bef\u5185\u5bb9\u7684\u7591\u60d1 \u95ee\u9898\uff1a \u5728nginx\u914d\u7f6e\u4e86\u8de8\u57df\u8bbe\u7f6e\u540e\uff0c\u524d\u7aef\u8bf7\u6c42\u8fd4\u56de\u7684\u5185\u5bb9\u4e0e\u9884\u671f\u4e0d\u4e00\u81f4\u3002\u6b63\u5e38\u60c5\u51b5\u4e0b\u5e94\u8fd4\u56de\u7279\u5b9a\u5185\u5bb9\uff0c\u4f46\u5b9e\u9645\u8fd4\u56de\u5374\u662f\u4e0d\u540c\u7684\u3002 \u89e3\u7b54\uff1a \u4f60\u63d0\u5230\u7684\u60c5\u51b5\u8868\u660e\uff0c\u4f60\u5c06\u4ee3\u7406\u8def\u5f84\u9519\u8bef\u5730\u914d\u7f6e\u5230\u4e86\u4f60\u7684\u524d\u7aef\u9879\u76ee\u76ee\u5f55\u4e2d\u3002\u5e94\u8be5\u5c06\u4ee3\u7406\u8bf7\u6c42\u8f6c\u53d1\u7ed9\u540e\u7aef\u63a5\u53e3\uff0c\u800c\u4e0d\u662f\u524d\u7aef\u9875\u9762\u3002 \u6b63\u786e\u7684\u914d\u7f6e\uff1a \u63d0\u4f9b\u4e00\u4e2a\u793a\u4f8b\u914d\u7f6e\u4f9b\u4f60\u53c2\u8003\uff1a server { listen 80; server_name localhost; charset utf-8; location \/ { root \/\u4f60\u7684\u524d\u7aef\u8def\u5f84; try_files $uri $uri\/ \/index.html; index index.html index.htm; } location \/api\/ { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header REMOTE-HOST $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass \/\u4f60\u7684\u540e\u7aef\u63a5\u53e3\u5730\u5740; client_max_body_size 50m; } } \u5728\u8be5\u914d\u7f6e\u4e2d\uff1a \/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-52735","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52735","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=52735"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52735\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52735"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52735"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52735"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}