{"id":52541,"date":"2024-12-03T10:04:36","date_gmt":"2024-12-03T02:04:36","guid":{"rendered":"https:\/\/fwq.ai\/blog\/52541\/"},"modified":"2024-12-03T10:04:36","modified_gmt":"2024-12-03T02:04:36","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%e9%94%99%e8%af%af%ef%bc%8c%e9%97%ae%e9%a2%98%e5%87%ba%e5%9c%a8%e5%93%aa%e9%87%8c%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/52541\/","title":{"rendered":"Nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f"},"content":{"rendered":"<p><b><\/b>     <\/p>\n<h1>Nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f<\/h1>\n<p>\u6700\u8fd1\u53d1\u73b0\u4e0d\u5c11\u5c0f\u4f19\u4f34\u90fd\u5bf9<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u5f88\u611f\u5174\u8da3\uff0c\u6240\u4ee5\u4eca\u5929\u7ee7\u7eed\u7ed9\u5927\u5bb6\u4ecb\u7ecd<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u6587\u7ae0<\/span>\u76f8\u5173\u7684\u77e5\u8bc6\uff0c\u672c\u6587<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aNginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u300b<\/span>\u4e3b\u8981\u5185\u5bb9\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01\u5f53\u7136\u5982\u679c\u9605\u8bfb\u672c\u6587\u65f6\u5b58\u5728\u4e0d\u540c\u60f3\u6cd5\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8868\u8fbe\uff0c\u4f46\u662f\u8bf7\u52ff\u4f7f\u7528\u8fc7\u6fc0\u7684\u63aa\u8f9e~<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241121\/1732169572673ecf6419cf9.jpg\" class=\"aligncenter\" title=\"Nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u63d2\u56fe\" alt=\"Nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong>nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef<\/strong><\/p>\n<p>\u5728\u4f7f\u7528nginx\u5904\u7406\u8de8\u57df\u8bf7\u6c42\u65f6\uff0c\u5982\u679c\u8bbe\u7f6e\u5b8c\u6210\u540e\u53d1\u73b0\u8fd4\u56de\u7684\u5185\u5bb9\u4e0d\u6b63\u786e\uff0c\u53ef\u80fd\u662f\u4ee5\u4e0b\u539f\u56e0\u5bfc\u81f4\uff1a<\/p>\n<p><strong>\u9519\u8bef\u914d\u7f6e<\/strong><\/p>\n<p>\u4f60\u5c06\u8de8\u57df\u4ee3\u7406\u6307\u5411\u4f60\u7684\u524d\u7aef\u9879\u76ee\u76ee\u5f55\uff0c\u800c\u4e0d\u662f\u540e\u7aef\u63a5\u53e3\u5730\u5740\u3002\u53c2\u8003\u4ee5\u4e0b\u914d\u7f6e\u793a\u4f8b\uff1a<\/p>\n<pre>server {\n    listen 80;\n    server_name localhost;\n    charset utf-8;\n    location \/ {\n        root \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 \u540e\u7aef\u63a5\u53e3\u5730\u5740;\n        client_max_body_size 50m;\n    }\n}<\/pre>\n<p>\u786e\u4fdd\u5c06&#8221;\u540e\u7aef\u63a5\u53e3\u5730\u5740&#8221;\u66ff\u6362\u4e3a\u4f60\u7684\u5b9e\u9645\u540e\u7aef\u63a5\u53e3\u5730\u5740\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u300aNginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt><\/dt>\n<dd>\n   \u9891\u7e41\u66f4\u65b0\u7d22\u5f15\u4f1a\u5f71\u54cd\u6027\u80fd\u5417\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>Nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f \u6700\u8fd1\u53d1\u73b0\u4e0d\u5c11\u5c0f\u4f19\u4f34\u90fd\u5bf9\u6587\u7ae0\u5f88\u611f\u5174\u8da3\uff0c\u6240\u4ee5\u4eca\u5929\u7ee7\u7eed\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u6587\u7ae0\u76f8\u5173\u7684\u77e5\u8bc6\uff0c\u672c\u6587\u300aNginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u300b\u4e3b\u8981\u5185\u5bb9\u6d89\u53ca\u5230\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5e0c\u671b\u80fd\u5e2e\u5230\u4f60\uff01\u5f53\u7136\u5982\u679c\u9605\u8bfb\u672c\u6587\u65f6\u5b58\u5728\u4e0d\u540c\u60f3\u6cd5\uff0c\u53ef\u4ee5\u5728\u8bc4\u8bba\u4e2d\u8868\u8fbe\uff0c\u4f46\u662f\u8bf7\u52ff\u4f7f\u7528\u8fc7\u6fc0\u7684\u63aa\u8f9e~ nginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef \u5728\u4f7f\u7528nginx\u5904\u7406\u8de8\u57df\u8bf7\u6c42\u65f6\uff0c\u5982\u679c\u8bbe\u7f6e\u5b8c\u6210\u540e\u53d1\u73b0\u8fd4\u56de\u7684\u5185\u5bb9\u4e0d\u6b63\u786e\uff0c\u53ef\u80fd\u662f\u4ee5\u4e0b\u539f\u56e0\u5bfc\u81f4\uff1a \u9519\u8bef\u914d\u7f6e \u4f60\u5c06\u8de8\u57df\u4ee3\u7406\u6307\u5411\u4f60\u7684\u524d\u7aef\u9879\u76ee\u76ee\u5f55\uff0c\u800c\u4e0d\u662f\u540e\u7aef\u63a5\u53e3\u5730\u5740\u3002\u53c2\u8003\u4ee5\u4e0b\u914d\u7f6e\u793a\u4f8b\uff1a server { listen 80; server_name localhost; charset utf-8; location \/ { root \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 \u540e\u7aef\u63a5\u53e3\u5730\u5740; client_max_body_size 50m; } } \u786e\u4fdd\u5c06&#8221;\u540e\u7aef\u63a5\u53e3\u5730\u5740&#8221;\u66ff\u6362\u4e3a\u4f60\u7684\u5b9e\u9645\u540e\u7aef\u63a5\u53e3\u5730\u5740\u3002 \u4ee5\u4e0a\u5c31\u662f\u300aNginx\u8de8\u57df\u8bbe\u7f6e\u540e\u8fd4\u56de\u5185\u5bb9\u9519\u8bef\uff0c\u95ee\u9898\u51fa\u5728\u54ea\u91cc\uff1f\u300b\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u5173\u4e8e\u7684\u8d44\u6599\u8bf7\u5173\u6ce8\u7c73\u4e91\u516c\u4f17\u53f7\uff01 \u9891\u7e41\u66f4\u65b0\u7d22\u5f15\u4f1a\u5f71\u54cd\u6027\u80fd\u5417\uff1f<\/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-52541","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52541","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=52541"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/52541\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=52541"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=52541"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=52541"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}