{"id":82346,"date":"2026-07-25T08:02:47","date_gmt":"2026-07-25T00:02:47","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/82346.html"},"modified":"2026-07-25T08:02:47","modified_gmt":"2026-07-25T00:02:47","slug":"devops%e7%b3%bb%e5%88%97%e4%b8%80-nginx-%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e4%b8%8e%e8%b4%9f%e8%bd%bd%e5%9d%87%e8%a1%a1%ef%bc%9a%e4%b8%80%e5%8f%b0%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%89%9b%e4%b8%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/82346.html","title":{"rendered":"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e"},"content":{"rendered":"<h2>devops\u7cfb\u5217(\u4e00)  Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861&#xff1a;\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e<\/h2>\n<h3>\u95ee\u9898\u5f15\u5165&#xff1a;\u534a\u591c\u88ab\u62a5\u8b66\u77ed\u4fe1\u70b8\u9192\u7684\u6ecb\u5473<\/h3>\n<p>\u4e0a\u4e2a\u6708\u6709\u4e2a\u5468\u4e09&#xff0c;\u51cc\u6668\u4e24\u70b9&#xff0c;\u6211\u88ab\u9489\u9489\u62a5\u8b66\u9707\u9192\u4e86\u3002<\/p>\n<p>\u6253\u5f00\u624b\u673a\u4e00\u770b&#xff0c;\u5168\u662f \u201cTomcat \u54cd\u5e94\u8d85\u65f6\u201d\u3001\u201c\u63a5\u53e3 504 Gateway Timeout\u201d \u7684\u544a\u8b66\u3002\u516c\u53f8\u4e1a\u52a1\u6700\u8fd1\u63a8\u5e7f\u4e86\u4e00\u6ce2&#xff0c;\u65e5\u6d3b\u4ece\u51e0\u5343\u8e6d\u8e6d\u6da8\u5230\u4e86\u51e0\u4e07&#xff0c;\u7ed3\u679c\u90a3\u53f0\u5b64\u96f6\u96f6\u7684 Tomcat \u670d\u52a1\u5668\u5f00\u59cb\u625b\u4e0d\u4f4f\u4e86\u3002<\/p>\n<p>\u767d\u5929\u7528\u6237\u8bbf\u95ee\u6162\u8fd8\u80fd\u5fcd&#xff0c;\u5230\u4e86\u9ad8\u5cf0\u671f\u76f4\u63a5\u9891\u7e41 502\/504&#xff0c;\u5ba2\u670d\u7fa4\u91cc\u70b8\u9505&#xff0c;\u8001\u677f\u5728\u7fa4\u91cc &#064; \u6211&#xff1a;\u201c\u600e\u4e48\u56de\u4e8b&#xff1f;\u4fee\u4e00\u4e0b\u3002\u201d<\/p>\n<p>\u6211\u722c\u8d77\u6765\u770b\u76d1\u63a7&#xff0c;CPU \u98d9\u5230 90%&#xff0c;\u5185\u5b58\u5feb\u6ee1\u4e86&#xff0c;GC \u9891\u7387\u9ad8\u5f97\u5413\u4eba\u3002\u6269\u5bb9\u673a\u5668&#xff1f;\u53ef\u4ee5&#xff0c;\u4f46\u4e00\u53f0 8 \u6838 16G \u7684\u670d\u52a1\u5668\u4e5f\u4e0d\u4fbf\u5b9c\u554a\u3002\u800c\u4e14\u5c31\u7b97\u786c\u4ef6\u5347\u7ea7\u4e86&#xff0c;\u5355\u70b9\u6545\u969c\u7684\u95ee\u9898\u8fd8\u662f\u6ca1\u89e3\u51b3\u2014\u2014\u8fd9\u53f0 Tomcat \u4e00\u6302&#xff0c;\u6574\u4e2a\u670d\u52a1\u5c31\u5168\u51c9\u4e86\u3002<\/p>\n<p>\u8bf4\u767d\u4e86&#xff0c;\u4e00\u53f0\u670d\u52a1\u5668\u5c31\u50cf\u4e00\u5bb6\u53ea\u6709\u4e00\u4e2a\u53a8\u5e08\u7684\u9910\u5385&#xff0c;\u996d\u70b9\u4e00\u5230&#xff0c;\u5ba2\u4eba\u5168\u5835\u5728\u67dc\u53f0\u524d&#xff0c;\u53a8\u5e08\u7d2f\u5f97\u624b\u5fd9\u811a\u4e71&#xff0c;\u540e\u9762\u7684\u5ba2\u4eba\u7b49\u4e0d\u53ca\u5c31\u5f00\u59cb\u9a82\u5a18\u3002<\/p>\n<p>\u90a3\u600e\u4e48\u529e&#xff1f;\u591a\u8bf7\u51e0\u4e2a\u53a8\u5e08&#xff0c;\u518d\u627e\u4e2a\u673a\u7075\u7684\u670d\u52a1\u5458\u5728\u95e8\u53e3\u7edf\u7b79\u5b89\u6392\u2014\u2014\u5ba2\u4eba\u6765\u4e86&#xff0c;\u670d\u52a1\u5458\u8d1f\u8d23\u5f15\u5bfc\u5230\u4e0d\u540c\u7684\u53a8\u5e08\u90a3\u513f&#xff0c;\u8c01\u95f2\u4e86\u7ed9\u8c01\u6d3e\u6d3b\u3002\u8fd9\u6837\u65e2\u80fd\u5206\u6d41\u538b\u529b&#xff0c;\u67d0\u4e2a\u53a8\u5e08\u8bf7\u5047\u4e86&#xff0c;\u5176\u4ed6\u53a8\u5e08\u8fd8\u80fd\u7ee7\u7eed\u5e72\u6d3b\u3002<\/p>\n<p>\u8fd9\u4e2a&#034;\u673a\u7075\u7684\u670d\u52a1\u5458&#034;&#xff0c;\u5c31\u662f\u54b1\u4eec\u4eca\u5929\u8981\u804a\u7684 Nginx\u3002<\/p>\n<hr \/>\n<h3>\u65b9\u6848\u5206\u6790&#xff1a;\u4e3a\u4ec0\u4e48\u9009 Nginx&#xff1f;<\/h3>\n<p>\u6211\u4e00\u5f00\u59cb\u4e5f\u60f3\u8fc7\u51e0\u4e2a\u65b9\u6848&#xff1a;<\/p>\n<p>\u65b9\u6848 A&#xff1a;\u76f4\u63a5\u5347\u7ea7 Tomcat \u670d\u52a1\u5668\u914d\u7f6e<\/p>\n<ul>\n<li>\u4f18\u70b9&#xff1a;\u7b80\u5355&#xff0c;\u6539\u4e2a\u4e91\u670d\u52a1\u5668\u914d\u7f6e\u5c31\u884c<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u8d35&#xff0c;\u800c\u4e14\u5355\u70b9\u6545\u969c\u6ca1\u89e3\u51b3&#xff0c;Tomcat \u672c\u8eab\u5e76\u53d1\u5904\u7406\u80fd\u529b\u4e5f\u6709\u9650<\/li>\n<\/ul>\n<p>\u65b9\u6848 B&#xff1a;\u7528 Tomcat \u96c6\u7fa4 &#043; \u786c\u4ef6\u8d1f\u8f7d\u5747\u8861<\/p>\n<ul>\n<li>\u4f18\u70b9&#xff1a;\u7a33\u5b9a<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u786c\u4ef6 F5 \u8d35\u5f97\u79bb\u8c31&#xff0c;\u5c0f\u516c\u53f8\u73a9\u4e0d\u8d77<\/li>\n<\/ul>\n<p>\u65b9\u6848 C&#xff1a;Nginx \u53cd\u5411\u4ee3\u7406 &#043; \u591a Tomcat \u8282\u70b9<\/p>\n<ul>\n<li>\u4f18\u70b9&#xff1a;\u514d\u8d39\u5f00\u6e90\u3001\u6027\u80fd\u5f6a\u608d\u3001\u914d\u7f6e\u7075\u6d3b\u3001\u793e\u533a\u751f\u6001\u6210\u719f<\/li>\n<li>\u7f3a\u70b9&#xff1a;\u9700\u8981\u5b66\u4e00\u70b9\u914d\u7f6e\u8bed\u6cd5&#xff08;\u4f46\u5176\u5b9e\u4e0d\u96be&#xff09;<\/li>\n<\/ul>\n<p>\u5bf9\u6bd4\u4e0b\u6765&#xff0c;Nginx \u5c31\u662f\u6027\u4ef7\u6bd4\u4e4b\u738b\u3002\u5b83\u4e0d\u4ec5\u80fd\u505a\u53cd\u5411\u4ee3\u7406\u548c\u8d1f\u8f7d\u5747\u8861&#xff0c;\u8fd8\u80fd\u5904\u7406\u9759\u6001\u8d44\u6e90\u3001\u505a\u7f13\u5b58\u3001\u538b\u7f29\u3001HTTPS \u7ec8\u6b62\u3001\u9650\u6d41\u9632\u5237\u2026\u2026\u7b80\u76f4\u5c31\u662f\u8fd0\u7ef4\u754c\u7684\u745e\u58eb\u519b\u5200\u3002<\/p>\n<p>\u4f46\u8fd9\u91cc\u6709\u4e2a\u6982\u5ff5\u5f88\u591a\u65b0\u624b\u5bb9\u6613\u61f5&#xff1a;\u53cd\u5411\u4ee3\u7406\u548c\u6b63\u5411\u4ee3\u7406\u5230\u5e95\u5565\u533a\u522b&#xff1f;<\/p>\n<h4>\u7528\u9910\u5385\u670d\u52a1\u5458\u6765\u7c7b\u6bd4<\/h4>\n<p>\u6b63\u5411\u4ee3\u7406&#xff0c;\u5c31\u50cf\u4f60&#xff08;\u5ba2\u6237\u7aef&#xff09;\u60f3\u6253\u7535\u8bdd\u7ed9\u67d0\u4e2a\u660e\u661f&#xff0c;\u4f46\u4f60\u4e0d\u65b9\u4fbf\u76f4\u63a5\u6253&#xff0c;\u4e8e\u662f\u627e\u4e86\u4e2a\u4e2d\u95f4\u4eba&#xff08;\u4ee3\u7406&#xff09;\u5e2e\u4f60\u6253\u3002\u660e\u661f\u4e0d\u77e5\u9053\u7535\u8bdd\u662f\u4f60\u6253\u7684&#xff0c;\u53ea\u77e5\u9053\u662f\u4e2d\u95f4\u4eba\u6253\u7684\u3002\u6b63\u5411\u4ee3\u7406\u4ee3\u7406\u7684\u662f\u5ba2\u6237\u7aef&#xff0c;\u9690\u85cf\u7684\u662f&#034;\u4f60&#034;\u3002<\/p>\n<p>\u53cd\u5411\u4ee3\u7406&#xff0c;\u5c31\u50cf\u4f60\u53bb\u4e00\u5bb6\u9ad8\u6863\u9910\u5385\u5403\u996d&#xff0c;\u95e8\u53e3\u6709\u4e2a\u670d\u52a1\u5458\u63a5\u5f85\u4f60&#xff0c;\u628a\u4f60\u9886\u5230\u5177\u4f53\u7684\u53a8\u5e08\u90a3\u513f\u3002\u4f60\u6839\u672c\u4e0d\u77e5\u9053\u53a8\u5e08\u662f\u8c01\u3001\u5728\u54ea&#xff0c;\u4f60\u53ea\u8ddf\u670d\u52a1\u5458\u6253\u4ea4\u9053\u3002\u53cd\u5411\u4ee3\u7406\u4ee3\u7406\u7684\u662f\u670d\u52a1\u7aef&#xff0c;\u9690\u85cf\u7684\u662f&#034;\u540e\u53a8&#034;\u3002<\/p>\n<p>Nginx \u5c31\u662f\u90a3\u4e2a\u7ad9\u5728\u95e8\u53e3\u7684\u670d\u52a1\u5458\u3002\u7528\u6237\u8bbf\u95ee\u7684\u662f Nginx \u7684 80 \u7aef\u53e3&#xff0c;Nginx \u518d\u628a\u8bf7\u6c42\u8f6c\u53d1\u7ed9\u540e\u7aef\u7684 Tomcat 1\u3001Tomcat 2\u3001Tomcat 3\u2026\u2026\u7528\u6237\u5b8c\u5168\u611f\u77e5\u4e0d\u5230\u540e\u7aef\u6709\u51e0\u53f0\u670d\u52a1\u5668\u3002<\/p>\n<hr \/>\n<h3>\u5b9e\u73b0\u8fc7\u7a0b&#xff1a;Step by Step \u4e0a\u624b<\/h3>\n<p>\u597d\u4e86&#xff0c;\u6982\u5ff5\u804a\u5b8c\u4e86&#xff0c;\u54b1\u4eec\u6765\u70b9\u5b9e\u5728\u7684\u3002\u5047\u8bbe\u4f60\u73b0\u5728\u6709\u4e24\u53f0 Tomcat&#xff0c;\u5206\u522b\u8dd1\u5728 192.168.1.101:8080 \u548c 192.168.1.102:8080&#xff0c;\u54b1\u4eec\u7528 Nginx \u628a\u5b83\u4eec\u4ee3\u7406\u8d77\u6765\u3002<\/p>\n<h4>Step 1&#xff1a;\u5b89\u88c5 Nginx&#xff08;\u7565\u8fc7\u7f16\u8bd1\u5b89\u88c5\u7684\u5751&#xff09;<\/h4>\n<p>\u5982\u679c\u4f60\u7528 CentOS&#xff0c;\u76f4\u63a5 yum \u88c5&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u6dfb\u52a0 EPEL \u6e90\u540e\u5b89\u88c5<\/span><br \/>\n<span class=\"token function\">sudo<\/span> yum <span class=\"token function\">install<\/span> nginx <span class=\"token parameter variable\">-y<\/span><\/p>\n<p><span class=\"token comment\"># \u542f\u52a8\u5e76\u8bbe\u7f6e\u5f00\u673a\u81ea\u542f<\/span><br \/>\n<span class=\"token function\">sudo<\/span> systemctl start nginx<br \/>\n<span class=\"token function\">sudo<\/span> systemctl <span class=\"token builtin class-name\">enable<\/span> nginx<\/p>\n<p>Ubuntu \u7684\u8bdd\u7528 apt install nginx\u3002\u7f16\u8bd1\u5b89\u88c5\u592a\u6298\u817e&#xff0c;\u65b0\u624b\u5efa\u8bae\u5148\u7528\u5305\u7ba1\u7406\u5668&#xff0c;\u628a\u6838\u5fc3\u6982\u5ff5\u641e\u660e\u767d\u518d\u8bf4\u3002<\/p>\n<h4>Step 2&#xff1a;\u914d\u7f6e\u53cd\u5411\u4ee3\u7406<\/h4>\n<p>Nginx \u7684\u6838\u5fc3\u914d\u7f6e\u6587\u4ef6\u4e00\u822c\u5728 \/etc\/nginx\/nginx.conf&#xff0c;\u4f46\u54b1\u4eec\u66f4\u5e38\u5728 \/etc\/nginx\/conf.d\/ \u4e0b\u521b\u5efa\u72ec\u7acb\u7684 .conf \u6587\u4ef6&#xff0c;\u65b9\u4fbf\u7ba1\u7406\u3002<\/p>\n<p>\u5148\u6765\u770b\u4e00\u4e2a\u6700\u7b80\u7248\u7684\u53cd\u5411\u4ee3\u7406\u914d\u7f6e&#xff1a;<\/p>\n<p># \/etc\/nginx\/conf.d\/myapp.conf<\/p>\n<p>server {<br \/>\n    listen 80;<br \/>\n    server_name api.example.com;<\/p>\n<p>    location \/ {<br \/>\n        # \u628a\u6240\u6709\u8bf7\u6c42\u8f6c\u53d1\u5230\u540e\u7aef Tomcat<br \/>\n        proxy_pass http:\/\/192.168.1.101:8080;<\/p>\n<p>        # \u5173\u952e&#xff1a;\u628a\u5ba2\u6237\u7aef\u771f\u5b9e IP \u4f20\u7ed9\u540e\u7aef&#xff0c;\u4e0d\u7136 Tomcat \u65e5\u5fd7\u91cc\u5168\u662f Nginx \u7684 IP<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd9\u6bb5\u8981\u5e72\u561b&#xff1f; \u544a\u8bc9 Nginx&#xff1a;\u6240\u6709\u8bbf\u95ee api.example.com:80 \u7684\u8bf7\u6c42&#xff0c;\u90fd\u5e2e\u6211\u7529\u7ed9 192.168.1.101:8080\u3002<\/p>\n<p>\u5173\u952e\u70b9\u5728\u54ea&#xff1f;<\/p>\n<ul>\n<li>proxy_pass \u662f\u6838\u5fc3&#xff0c;\u6307\u5b9a\u540e\u7aef\u5730\u5740<\/li>\n<li>proxy_set_header \u8fd9\u4e09\u884c\u975e\u5e38\u91cd\u8981&#xff0c;\u5426\u5219\u540e\u7aef\u62ff\u4e0d\u5230\u7528\u6237\u7684\u771f\u5b9e IP \u548c\u539f\u59cb Host&#xff0c;\u6709\u4e9b\u4e1a\u52a1\u903b\u8f91\u4f1a\u51fa\u95ee\u9898<\/li>\n<\/ul>\n<p>\u914d\u7f6e\u5199\u5b8c\u540e&#xff0c;\u4e00\u5b9a\u8981\u6267\u884c reload&#xff1a;<\/p>\n<p><span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-s<\/span> reload<\/p>\n<p>\u5f88\u591a\u65b0\u624b\u6539\u5b8c\u914d\u7f6e\u53d1\u73b0\u6ca1\u751f\u6548&#xff0c;\u5c31\u662f\u56e0\u4e3a\u5fd8\u4e86\u8fd9\u6b65\u3002\u540e\u9762\u6211\u4f1a\u4e13\u95e8\u8bb2\u8fd9\u4e2a\u5751\u3002<\/p>\n<h4>Step 3&#xff1a;\u8d1f\u8f7d\u5747\u8861\u2014\u2014\u4e00\u53f0\u4e0d\u591f&#xff0c;\u591a\u53f0\u4e00\u8d77\u625b<\/h4>\n<p>\u73b0\u5728\u54b1\u4eec\u6709\u4e24\u53f0 Tomcat \u4e86&#xff0c;\u603b\u4e0d\u80fd\u53ea\u4ee3\u7406\u4e00\u53f0\u5427&#xff1f;Nginx \u7684 upstream \u6a21\u5757\u5c31\u662f\u5e72\u8fd9\u4e2a\u7684\u3002<\/p>\n<p># \u5148\u5b9a\u4e49\u4e00\u4e2a\u540e\u7aef\u670d\u52a1\u5668\u6c60&#xff0c;\u53eb tomcat_cluster<br \/>\nupstream tomcat_cluster {<br \/>\n    server 192.168.1.101:8080;<br \/>\n    server 192.168.1.102:8080;<br \/>\n}<\/p>\n<p>server {<br \/>\n    listen 80;<br \/>\n    server_name api.example.com;<\/p>\n<p>    location \/ {<br \/>\n        proxy_pass http:\/\/tomcat_cluster;  # \u6ce8\u610f\u8fd9\u91cc\u5199\u7684\u662f upstream \u7684\u540d\u5b57<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd9\u6bb5\u8981\u5e72\u561b&#xff1f; \u628a\u8bf7\u6c42\u8f6e\u6d41\u5206\u53d1\u7ed9\u4e24\u53f0 Tomcat&#xff0c;\u5b9e\u73b0\u6700\u57fa\u672c\u7684\u8d1f\u8f7d\u5747\u8861\u3002<\/p>\n<p>\u9ed8\u8ba4\u7b56\u7565\u662f\u8f6e\u8be2&#xff08;round-robin&#xff09;&#xff0c;\u5c31\u662f\u8bf7\u6c42 1 \u7ed9 101&#xff0c;\u8bf7\u6c42 2 \u7ed9 102&#xff0c;\u8bf7\u6c42 3 \u7ed9 101&#xff0c;\u4f9d\u6b21\u5faa\u73af\u3002<\/p>\n<h4>Step 4&#xff1a;\u56db\u79cd\u8d1f\u8f7d\u5747\u8861\u7b56\u7565&#xff0c;\u600e\u4e48\u9009&#xff1f;<\/h4>\n<p>Nginx \u652f\u6301\u597d\u51e0\u79cd\u8d1f\u8f7d\u5747\u8861\u7b56\u7565&#xff0c;\u4e0d\u540c\u7684\u573a\u666f\u7528\u4e0d\u540c\u7684\u7b56\u7565&#xff0c;\u522b\u53ea\u4f1a\u8f6e\u8be2\u3002<\/p>\n<h5>1. \u8f6e\u8be2&#xff08;round-robin&#xff09;\u2014\u2014\u9ed8\u8ba4\u7b56\u7565<\/h5>\n<p>upstream tomcat_cluster {<br \/>\n    server 192.168.1.101:8080;<br \/>\n    server 192.168.1.102:8080;<br \/>\n}<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u540e\u7aef\u673a\u5668\u914d\u7f6e\u5dee\u4e0d\u591a&#xff0c;\u8bf7\u6c42\u5904\u7406\u65f6\u95f4\u4e5f\u5dee\u4e0d\u591a\u3002\u7b80\u5355\u516c\u5e73\u3002<\/p>\n<h5>2. \u6743\u91cd&#xff08;weight&#xff09;\u2014\u2014\u80fd\u8005\u591a\u52b3<\/h5>\n<p>upstream tomcat_cluster {<br \/>\n    server 192.168.1.101:8080 weight&#061;3;<br \/>\n    server 192.168.1.102:8080 weight&#061;1;<br \/>\n}<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u4e24\u53f0\u673a\u5668\u914d\u7f6e\u4e0d\u4e00\u6837&#xff0c;101 \u662f 8 \u6838 16G&#xff0c;102 \u662f 4 \u6838 8G\u3002\u90a3\u5c31\u8ba9 101 \u591a\u625b\u70b9\u6d3b&#xff0c;\u6743\u91cd\u8bbe\u4e3a 3:1\u3002<\/p>\n<h5>3. ip_hash\u2014\u2014\u540c\u4e00\u4e2a\u7528\u6237\u59cb\u7ec8\u843d\u5728\u540c\u4e00\u53f0\u673a\u5668<\/h5>\n<p>upstream tomcat_cluster {<br \/>\n    ip_hash;<br \/>\n    server 192.168.1.101:8080;<br \/>\n    server 192.168.1.102:8080;<br \/>\n}<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u4f60\u7684\u5e94\u7528\u7528\u4e86\u672c\u5730 Session \u5b58\u50a8&#xff0c;\u7528\u6237\u767b\u5f55\u72b6\u6001\u5b58\u5728 Tomcat \u5185\u5b58\u91cc\u3002\u5982\u679c\u8bf7\u6c42\u88ab\u5206\u914d\u5230\u4e0d\u540c\u673a\u5668&#xff0c;\u7528\u6237\u5c31\u4f1a\u9891\u7e41\u6389\u7ebf\u3002<\/p>\n<p>\u4f46\u8981\u6ce8\u610f&#xff1a;ip_hash \u4e0d\u662f\u4e07\u80fd\u7684&#xff0c;\u5982\u679c\u67d0\u53f0\u673a\u5668\u6302\u4e86&#xff0c;\u539f\u672c\u843d\u5728\u8fd9\u53f0\u7684\u8bf7\u6c42\u4f1a\u91cd\u65b0 hash \u5230\u5176\u4ed6\u673a\u5668\u3002\u800c\u4e14\u5982\u679c\u7528\u6237\u5728\u516c\u53f8\u5185\u7f51&#xff0c;\u51fa\u53e3 IP \u76f8\u540c&#xff0c;\u53ef\u80fd\u4f1a\u5bfc\u81f4\u67d0\u4e00\u53f0\u673a\u5668\u538b\u529b\u7279\u522b\u5927\u3002<\/p>\n<h5>4. least_conn\u2014\u2014\u8c01\u95f2\u7ed9\u8c01<\/h5>\n<p>upstream tomcat_cluster {<br \/>\n    least_conn;<br \/>\n    server 192.168.1.101:8080;<br \/>\n    server 192.168.1.102:8080;<br \/>\n}<\/p>\n<p>\u9002\u7528\u573a\u666f&#xff1a;\u63a5\u53e3\u5904\u7406\u65f6\u95f4\u5dee\u5f02\u5f88\u5927&#xff0c;\u6709\u7684\u8bf7\u6c42 10ms \u641e\u5b9a&#xff0c;\u6709\u7684\u8981 10 \u79d2\u3002least_conn \u4f1a\u628a\u65b0\u8bf7\u6c42\u53d1\u7ed9\u5f53\u524d\u8fde\u63a5\u6570\u6700\u5c11\u7684\u673a\u5668&#xff0c;\u66f4\u667a\u80fd\u4e00\u4e9b\u3002<\/p>\n<p>\u6211\u7684\u5efa\u8bae&#xff1a;\u5982\u679c\u505a\u4e86\u5206\u5e03\u5f0f Session&#xff08;\u6bd4\u5982 Redis \u5b58 Session&#xff09;&#xff0c;\u4f18\u5148\u7528 \u8f6e\u8be2 \u6216 least_conn&#xff1b;\u5982\u679c\u8fd8\u662f\u672c\u5730 Session&#xff0c;\u4e34\u65f6\u7528 ip_hash \u8fc7\u6e21&#xff0c;\u4f46\u957f\u8fdc\u770b\u8fd8\u662f\u8981\u4e0a\u5206\u5e03\u5f0f Session\u3002<\/p>\n<h4>Step 5&#xff1a;\u9759\u6001\u8d44\u6e90\u5206\u79bb\u2014\u2014\u522b\u8ba9 Tomcat \u5e72\u6742\u6d3b<\/h4>\n<p>Tomcat \u5904\u7406\u52a8\u6001\u8bf7\u6c42\u8fd8\u884c&#xff0c;\u4f46\u8ba9\u5b83\u53bb\u4f20\u56fe\u7247\u3001CSS\u3001JS&#xff0c;\u90a3\u5c31\u662f\u5927\u6750\u5c0f\u7528&#xff0c;\u8fd8\u62d6\u7d2f\u52a8\u6001\u63a5\u53e3\u7684\u54cd\u5e94\u901f\u5ea6\u3002<\/p>\n<p>Nginx \u4f20\u9759\u6001\u6587\u4ef6\u7684\u80fd\u529b\u662f Tomcat \u7684\u51e0\u5341\u500d&#xff0c;\u6240\u4ee5\u54b1\u4eec\u8981\u8ba9 Nginx \u76f4\u63a5\u5904\u7406\u9759\u6001\u8d44\u6e90&#xff0c;\u52a8\u6001\u8bf7\u6c42\u624d\u8f6c\u53d1\u7ed9 Tomcat\u3002<\/p>\n<p>server {<br \/>\n    listen 80;<br \/>\n    server_name api.example.com;<\/p>\n<p>    root \/usr\/share\/nginx\/html;<\/p>\n<p>    # \u9759\u6001\u8d44\u6e90\u76f4\u63a5\u7531 Nginx \u8fd4\u56de<br \/>\n    location ~* \\\\.(jpg|jpeg|png|gif|ico|css|js|woff|woff2)$ {<br \/>\n        expires 30d;           # \u7f13\u5b58 30 \u5929<br \/>\n        add_header Cache-Control &#034;public, immutable&#034;;<br \/>\n        access_log off;        # \u5173\u95ed\u9759\u6001\u8d44\u6e90\u8bbf\u95ee\u65e5\u5fd7&#xff0c;\u51cf\u5c11\u78c1\u76d8 IO<br \/>\n    }<\/p>\n<p>    # \u52a8\u6001\u8bf7\u6c42\u8f6c\u53d1\u7ed9 Tomcat<br \/>\n    location \/api\/ {<br \/>\n        proxy_pass http:\/\/tomcat_cluster;<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd9\u6bb5\u8981\u5e72\u561b&#xff1f; \u56fe\u7247\u3001CSS\u3001JS \u8fd9\u4e9b\u6587\u4ef6&#xff0c;Nginx \u81ea\u5df1\u4ece\u78c1\u76d8\u8bfb\u51fa\u6765\u8fd4\u56de\u7ed9\u7528\u6237&#xff1b;\u53ea\u6709 \/api\/ \u5f00\u5934\u7684\u63a5\u53e3\u8bf7\u6c42&#xff0c;\u624d\u8f6c\u53d1\u7ed9 Tomcat\u3002<\/p>\n<p>\u6548\u679c\u5f88\u660e\u663e&#xff1a;\u6211\u4e0a\u6b21\u52a0\u4e86\u8fd9\u4e2a\u914d\u7f6e\u540e&#xff0c;Tomcat \u7684 CPU \u4f7f\u7528\u7387\u76f4\u63a5\u964d\u4e86 30%&#xff0c;\u9875\u9762\u52a0\u8f7d\u901f\u5ea6\u4e5f\u5feb\u4e86\u4e00\u622a\u3002<\/p>\n<h4>Step 6&#xff1a;Gzip \u538b\u7f29\u2014\u2014\u8ba9\u4f20\u8f93\u66f4\u5feb<\/h4>\n<p>\u73b0\u5728\u7684\u524d\u7aef\u8d44\u6e90\u52a8\u4e0d\u52a8\u5c31\u51e0\u767e KB&#xff0c;\u5f00\u542f Gzip \u538b\u7f29\u80fd\u7701\u4e0d\u5c11\u5e26\u5bbd\u3002<\/p>\n<p>http {<br \/>\n    # \u5728 nginx.conf \u7684 http \u5757\u91cc\u52a0<br \/>\n    gzip on;<br \/>\n    gzip_types text\/plain text\/css application\/json application\/javascript text\/xml application\/xml application\/xml&#043;rss text\/javascript;<br \/>\n    gzip_min_length 1k;      # \u5c0f\u4e8e 1K \u7684\u6587\u4ef6\u4e0d\u538b\u7f29&#xff0c;\u7701 CPU<br \/>\n    gzip_comp_level 4;       # \u538b\u7f29\u7ea7\u522b 1-9&#xff0c;4 \u662f\u6027\u4ef7\u6bd4\u5e73\u8861\u70b9<br \/>\n}<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u8bbe gzip_min_length 1k&#xff1f; \u56e0\u4e3a\u538b\u7f29\u672c\u8eab\u4e5f\u8981\u6d88\u8017 CPU&#xff0c;\u5982\u679c\u6587\u4ef6\u672c\u6765\u5c31\u51e0\u5b57\u8282&#xff0c;\u538b\u7f29\u540e\u53ef\u80fd\u53cd\u800c\u66f4\u5927&#xff0c;\u5f97\u4e0d\u507f\u5931\u3002<\/p>\n<h4>Step 7&#xff1a;HTTPS \u914d\u7f6e\u2014\u2014\u73b0\u5728\u6ca1 HTTPS \u90fd\u4e0d\u597d\u610f\u601d\u4e0a\u7ebf<\/h4>\n<p>\u7533\u8bf7\u4e00\u4e2a\u514d\u8d39 SSL \u8bc1\u4e66&#xff08;Let\u2019s Encrypt \u6216\u8005\u963f\u91cc\u4e91\u514d\u8d39\u8bc1\u4e66&#xff09;&#xff0c;\u914d\u7f6e\u5f88\u7b80\u5355&#xff1a;<\/p>\n<p>server {<br \/>\n    listen 443 ssl;<br \/>\n    server_name api.example.com;<\/p>\n<p>    ssl_certificate \/etc\/nginx\/ssl\/api.example.com.crt;<br \/>\n    ssl_certificate_key \/etc\/nginx\/ssl\/api.example.com.key;<br \/>\n    ssl_protocols TLSv1.2 TLSv1.3;<\/p>\n<p>    location \/ {<br \/>\n        proxy_pass http:\/\/tomcat_cluster;<br \/>\n        proxy_set_header Host $host;<br \/>\n        proxy_set_header X-Real-IP $remote_addr;<br \/>\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br \/>\n    }<br \/>\n}<\/p>\n<p># HTTP \u81ea\u52a8\u8df3 HTTPS<br \/>\nserver {<br \/>\n    listen 80;<br \/>\n    server_name api.example.com;<br \/>\n    return 301 https:\/\/$server_name$request_uri;<br \/>\n}<\/p>\n<p>\u5173\u952e\u63d0\u9192&#xff1a;HTTPS \u914d\u5b8c\u540e&#xff0c;\u4e00\u5b9a\u8981\u68c0\u67e5\u8bc1\u4e66\u6709\u6548\u671f&#xff0c;\u8bbe\u7f6e\u81ea\u52a8\u7eed\u671f\u3002\u6211\u6709\u4e00\u6b21\u5c31\u56e0\u4e3a\u8bc1\u4e66\u8fc7\u671f\u4e86&#xff0c;\u5bfc\u81f4\u5168\u7ad9\u65e0\u6cd5\u8bbf\u95ee&#xff0c;\u88ab\u8001\u677f\u5728\u7fa4\u91cc\u70b9\u540d\u6279\u8bc4\u2026\u2026<\/p>\n<h4>Step 8&#xff1a;\u9650\u6d41\u9632\u5237\u2014\u2014\u7ed9\u7cfb\u7edf\u52a0\u4e2a\u4fdd\u9669\u6760<\/h4>\n<p>\u63a5\u53e3\u88ab\u722c\u866b\u72c2\u5237\u600e\u4e48\u529e&#xff1f;Nginx \u53ef\u4ee5\u7b80\u5355\u9650\u6d41\u3002\u8fd9\u91cc\u4ecb\u7ecd\u4e24\u79cd\u5e38\u7528\u7684&#xff1a;<\/p>\n<p>\u9650\u5236\u5355 IP \u5e76\u53d1\u8fde\u63a5\u6570&#xff1a;<\/p>\n<p># \u5728 http \u5757\u5b9a\u4e49\u4e00\u4e2a\u8fde\u63a5\u9650\u5236\u533a\u57df<br \/>\nlimit_conn_zone $binary_remote_addr zone&#061;addr:10m;<\/p>\n<p>server {<br \/>\n    location \/api\/ {<br \/>\n        limit_conn addr 10;  # \u5355\u4e2a IP \u6700\u591a 10 \u4e2a\u5e76\u53d1\u8fde\u63a5<br \/>\n        proxy_pass http:\/\/tomcat_cluster;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u9650\u5236\u8bf7\u6c42\u901f\u7387&#xff08;\u6f0f\u6876\u7b97\u6cd5&#xff09;&#xff1a;<\/p>\n<p># \u5728 http \u5757\u5b9a\u4e49<br \/>\nlimit_req_zone $binary_remote_addr zone&#061;one:10m rate&#061;10r\/s;<\/p>\n<p>server {<br \/>\n    location \/api\/ {<br \/>\n        limit_req zone&#061;one burst&#061;20 nodelay;  # \u6bcf\u79d2 10 \u4e2a\u8bf7\u6c42&#xff0c;\u7a81\u53d1 20 \u4e2a<br \/>\n        proxy_pass http:\/\/tomcat_cluster;<br \/>\n    }<br \/>\n}<\/p>\n<p>\u5173\u952e\u70b9&#xff1a;rate&#061;10r\/s \u662f\u5e73\u5747\u6bcf\u79d2 10 \u4e2a\u8bf7\u6c42&#xff0c;burst&#061;20 \u5141\u8bb8\u7a81\u53d1 20 \u4e2a\u8bf7\u6c42\u6392\u961f\u5904\u7406&#xff0c;nodelay \u8868\u793a\u4e0d\u5ef6\u8fdf&#xff0c;\u76f4\u63a5\u5904\u7406\u3002\u5982\u679c\u8d85\u8fc7\u4e86&#xff0c;Nginx \u4f1a\u8fd4\u56de 503\u3002<\/p>\n<p>\u9650\u6d41\u8fd9\u73a9\u610f\u513f\u4e0d\u80fd\u8bbe\u592a\u6b7b&#xff0c;\u4e0d\u7136\u6b63\u5e38\u7528\u6237\u4e5f\u53ef\u80fd\u88ab\u8bef\u4f24\u3002\u5efa\u8bae\u5148\u8bbe\u5bbd\u677e\u4e00\u70b9&#xff0c;\u89c2\u5bdf\u65e5\u5fd7\u518d\u8c03\u6574\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u4efd\u751f\u4ea7\u7ea7\u7cbe\u7b80\u914d\u7f6e\u53c2\u8003<\/h3>\n<p>\u8bf4\u4e86\u8fd9\u4e48\u591a&#xff0c;\u6211\u628a\u4e0a\u9762\u8fd9\u4e9b\u6574\u5408\u6210\u4e00\u4efd\u751f\u4ea7\u53ef\u7528\u7684\u7cbe\u7b80\u914d\u7f6e&#xff0c;\u4f60\u53ef\u4ee5\u76f4\u63a5\u62ff\u53bb\u6539\u6539 IP \u5c31\u80fd\u7528&#xff1a;<\/p>\n<p># \/etc\/nginx\/nginx.conf<\/p>\n<p>user nginx;<br \/>\nworker_processes auto;           # \u6839\u636e CPU \u6838\u6570\u81ea\u52a8\u8c03\u6574<br \/>\nerror_log \/var\/log\/nginx\/error.log warn;<br \/>\npid \/var\/run\/nginx.pid;<\/p>\n<p>events {<br \/>\n    worker_connections 4096;     # \u5355\u4e2a worker \u7684\u6700\u5927\u8fde\u63a5\u6570<br \/>\n    use epoll;                   # Linux \u9ad8\u6027\u80fd\u7f51\u7edc\u6a21\u578b<br \/>\n    multi_accept on;<br \/>\n}<\/p>\n<p>http {<br \/>\n    include \/etc\/nginx\/mime.types;<br \/>\n    default_type application\/octet-stream;<\/p>\n<p>    # &#061;&#061;&#061; \u65e5\u5fd7\u683c\u5f0f &#061;&#061;&#061;<br \/>\n    log_format main &#039;$remote_addr &#8211; $remote_user [$time_local] &#034;$request&#034; &#039;<br \/>\n                    &#039;$status $body_bytes_sent &#034;$http_referer&#034; &#039;<br \/>\n                    &#039;&#034;$http_user_agent&#034; &#034;$http_x_forwarded_for&#034;&#039;;<\/p>\n<p>    access_log \/var\/log\/nginx\/access.log main;<\/p>\n<p>    # &#061;&#061;&#061; \u6027\u80fd\u4f18\u5316 &#061;&#061;&#061;<br \/>\n    sendfile on;<br \/>\n    tcp_nopush on;<br \/>\n    tcp_nodelay on;<br \/>\n    keepalive_timeout 65;<br \/>\n    client_max_body_size 50m;    # \u5141\u8bb8\u4e0a\u4f20\u7684\u6700\u5927\u6587\u4ef6\u5927\u5c0f<\/p>\n<p>    # &#061;&#061;&#061; Gzip \u538b\u7f29 &#061;&#061;&#061;<br \/>\n    gzip on;<br \/>\n    gzip_vary on;<br \/>\n    gzip_min_length 1k;<br \/>\n    gzip_comp_level 4;<br \/>\n    gzip_types text\/plain text\/css application\/json application\/javascript text\/xml application\/xml application\/xml&#043;rss text\/javascript;<\/p>\n<p>    # &#061;&#061;&#061; \u8d1f\u8f7d\u5747\u8861 upstream &#061;&#061;&#061;<br \/>\n    upstream tomcat_cluster {<br \/>\n        least_conn;              # \u8c01\u95f2\u7ed9\u8c01&#xff0c;\u6bd4\u8f6e\u8be2\u66f4\u667a\u80fd<br \/>\n        server 192.168.1.101:8080 weight&#061;2;<br \/>\n        server 192.168.1.102:8080 weight&#061;1;<\/p>\n<p>        # \u5065\u5eb7\u68c0\u67e5&#xff1a;\u5931\u8d25 3 \u6b21\u8ba4\u4e3a\u4e0d\u53ef\u7528&#xff0c;\u6062\u590d 2 \u6b21\u8ba4\u4e3a\u53ef\u7528<br \/>\n        server 192.168.1.101:8080 max_fails&#061;3 fail_timeout&#061;30s;<br \/>\n        server 192.168.1.102:8080 max_fails&#061;3 fail_timeout&#061;30s;<br \/>\n    }<\/p>\n<p>    # &#061;&#061;&#061; \u865a\u62df\u4e3b\u673a\u914d\u7f6e &#061;&#061;&#061;<br \/>\n    server {<br \/>\n        listen 80;<br \/>\n        server_name api.example.com;<\/p>\n<p>        # HTTP \u8df3\u8f6c HTTPS&#xff08;\u5982\u679c\u4e0d\u9700\u8981 HTTPS \u53ef\u4ee5\u6ce8\u91ca\u6389&#xff09;<br \/>\n        return 301 https:\/\/$server_name$request_uri;<br \/>\n    }<\/p>\n<p>    server {<br \/>\n        listen 443 ssl;<br \/>\n        server_name api.example.com;<\/p>\n<p>        ssl_certificate \/etc\/nginx\/ssl\/api.example.com.crt;<br \/>\n        ssl_certificate_key \/etc\/nginx\/ssl\/api.example.com.key;<br \/>\n        ssl_protocols TLSv1.2 TLSv1.3;<\/p>\n<p>        root \/usr\/share\/nginx\/html;<\/p>\n<p>        # \u9759\u6001\u8d44\u6e90\u76f4\u63a5\u7531 Nginx \u5904\u7406<br \/>\n        location ~* \\\\.(jpg|jpeg|png|gif|ico|css|js|woff|woff2)$ {<br \/>\n            expires 30d;<br \/>\n            add_header Cache-Control &#034;public, immutable&#034;;<br \/>\n            access_log off;<br \/>\n        }<\/p>\n<p>        # \u52a8\u6001 API \u8f6c\u53d1\u7ed9 Tomcat \u96c6\u7fa4<br \/>\n        location \/api\/ {<br \/>\n            proxy_pass http:\/\/tomcat_cluster;<br \/>\n            proxy_set_header Host $host;<br \/>\n            proxy_set_header X-Real-IP $remote_addr;<br \/>\n            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<\/p>\n<p>            # \u8fde\u63a5\u8d85\u65f6\u8bbe\u7f6e<br \/>\n            proxy_connect_timeout 5s;<br \/>\n            proxy_send_timeout 10s;<br \/>\n            proxy_read_timeout 30s;<br \/>\n        }<br \/>\n    }<br \/>\n}<\/p>\n<p>\u8fd9\u4efd\u914d\u7f6e\u7684\u6838\u5fc3\u601d\u8def&#xff1a;<\/p>\n<ul>\n<li>Nginx \u8d1f\u8d23 SSL \u7ec8\u6b62\u3001\u9759\u6001\u8d44\u6e90\u3001Gzip \u538b\u7f29\u3001\u8d1f\u8f7d\u5747\u8861<\/li>\n<li>Tomcat \u53ea\u4e13\u6ce8\u5904\u7406\u52a8\u6001\u4e1a\u52a1\u903b\u8f91<\/li>\n<li>\u901a\u8fc7 least_conn \u548c\u6743\u91cd\u5b9e\u73b0\u667a\u80fd\u5206\u6d41<\/li>\n<li>\u5065\u5eb7\u68c0\u67e5\u786e\u4fdd\u5355\u70b9\u6545\u969c\u65f6\u81ea\u52a8\u5254\u9664\u5f02\u5e38\u8282\u70b9<\/li>\n<\/ul>\n<hr \/>\n<h3>\u8e29\u5751\u8bb0\u5f55&#xff1a;\u6211\u8e29\u8fc7\u7684\u4e24\u4e2a\u5927\u5751<\/h3>\n<p>\u5149\u8bb2\u914d\u7f6e\u6ca1\u610f\u601d&#xff0c;\u5206\u4eab\u4e24\u4e2a\u6211\u771f\u5b9e\u8e29\u8fc7\u7684\u5751&#xff0c;\u8bf4\u4e0d\u5b9a\u4f60\u6b63\u5728\u8e29\u6216\u8005\u5373\u5c06\u8e29\u3002<\/p>\n<h4>\u5751\u4e00&#xff1a;\u6539\u5b8c\u914d\u7f6e\u6ca1\u751f\u6548&#xff1f;\u56e0\u4e3a\u4f60\u6ca1 reload&#xff01;<\/h4>\n<p>\u8fd9\u4e2a\u5751\u6211\u8e29\u8fc7\u4e0d\u4e0b\u4e09\u6b21\u3002<\/p>\n<p>Nginx \u7684\u914d\u7f6e\u6587\u4ef6\u6539\u5b8c\u540e&#xff0c;\u5fc5\u987b\u6267\u884c nginx -s reload \u624d\u80fd\u70ed\u52a0\u8f7d\u65b0\u914d\u7f6e\u3002\u5982\u679c\u4f60\u53ea\u6539\u4e86\u6587\u4ef6\u5c31\u5b8c\u4e8b\u4e86&#xff0c;Nginx \u8fd8\u5728\u7528\u65e7\u7684\u914d\u7f6e\u5728\u8dd1\u3002<\/p>\n<p>\u66f4\u5751\u7684\u662f&#xff0c;\u6709\u65f6\u5019\u4f60\u6267\u884c\u4e86 reload&#xff0c;\u4f46\u8bed\u6cd5\u6709\u9519\u8bef&#xff0c;Nginx \u4f1a\u62d2\u7edd\u52a0\u8f7d\u65b0\u914d\u7f6e&#xff0c;\u7136\u540e\u9ed8\u9ed8\u5730\u7ee7\u7eed\u7528\u65e7\u914d\u7f6e\u8fd0\u884c\u3002\u4f60\u4ee5\u4e3a\u662f\u65b0\u914d\u7f6e\u751f\u6548\u4e86&#xff0c;\u5b9e\u9645\u4e0a\u8fd8\u662f\u8001\u6837\u5b50\u3002<\/p>\n<p>\u6b63\u786e\u505a\u6cd5&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u5148\u68c0\u67e5\u8bed\u6cd5\u662f\u5426\u6b63\u786e<\/span><br \/>\n<span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-t<\/span><\/p>\n<p><span class=\"token comment\"># \u8bed\u6cd5 OK \u540e\u518d reload<\/span><br \/>\n<span class=\"token function\">sudo<\/span> nginx <span class=\"token parameter variable\">-s<\/span> reload<\/p>\n<p>\u517b\u6210 nginx -t \u7684\u4e60\u60ef&#xff0c;\u80fd\u6551\u547d\u3002<\/p>\n<h4>\u5751\u4e8c&#xff1a;location \u8def\u5f84\u5339\u914d\u4f18\u5148\u7ea7\u641e\u9519<\/h4>\n<p>Nginx \u7684 location \u5339\u914d\u89c4\u5219\u6709\u70b9\u53cd\u76f4\u89c9&#xff0c;\u4e0d\u662f\u7b80\u5355\u7684&#034;\u8c01\u5728\u524d\u9762\u5148\u5339\u914d\u8c01&#034;\u3002<\/p>\n<p>\u5b83\u7684\u4f18\u5148\u7ea7\u662f\u8fd9\u6837\u7684&#xff1a;<\/p>\n<li>&#061; \u7cbe\u786e\u5339\u914d&#xff08;\u6700\u9ad8\u4f18\u5148\u7ea7&#xff09;<\/li>\n<li>^~ \u524d\u7f00\u5339\u914d<\/li>\n<li>~ \u548c ~* \u6b63\u5219\u5339\u914d&#xff08;\u6309\u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u987a\u5e8f&#xff09;<\/li>\n<li>\u666e\u901a\u524d\u7f00\u5339\u914d<\/li>\n<li>\/ \u901a\u7528\u5339\u914d&#xff08;\u6700\u4f4e\u4f18\u5148\u7ea7&#xff09;<\/li>\n<p>\u6709\u4e00\u6b21\u6211\u628a\u9759\u6001\u8d44\u6e90\u7684\u6b63\u5219\u5339\u914d\u5199\u5728\u4e86 \/api\/ \u7684\u540e\u9762&#xff0c;\u7ed3\u679c\u67d0\u4e9b\u5e26 .js \u540e\u7f00\u7684 API \u8bf7\u6c42\u88ab Nginx \u5f53\u6210\u9759\u6001\u8d44\u6e90\u5904\u7406\u4e86&#xff0c;\u76f4\u63a5\u8fd4\u56de 404&#xff0c;\u67e5\u4e86\u534a\u5929\u624d\u53d1\u73b0\u662f location \u987a\u5e8f\u7684\u95ee\u9898\u3002<\/p>\n<p>\u5efa\u8bae&#xff1a;\u6b63\u5219\u5339\u914d\u7684 location \u5c3d\u91cf\u6309\u7cbe\u786e\u5ea6\u4ece\u9ad8\u5230\u4f4e\u6392\u5217&#xff0c;\u6216\u8005\u76f4\u63a5\u7528 ^~ \u505a\u524d\u7f00\u5339\u914d&#xff0c;\u907f\u514d\u610f\u5916\u3002<\/p>\n<hr \/>\n<h3>\u9a8c\u8bc1\u6548\u679c&#xff1a;\u6539\u9020\u524d\u540e\u5bf9\u6bd4<\/h3>\n<p>\u54b1\u4eec\u6765\u9a8c\u6536\u4e00\u4e0b\u6210\u679c\u3002<\/p>\n<p>\u6539\u9020\u524d&#xff1a;<\/p>\n<ul>\n<li>\u5355\u53f0 Tomcat \u625b\u6240\u6709\u8bf7\u6c42<\/li>\n<li>\u9ad8\u5cf0\u671f CPU 90%&#043;&#xff0c;\u9891\u7e41 502\/504<\/li>\n<li>\u9759\u6001\u8d44\u6e90\u548c\u52a8\u6001\u8bf7\u6c42\u6df7\u5728\u4e00\u8d77&#xff0c;\u4e92\u76f8\u62d6\u7d2f<\/li>\n<\/ul>\n<p>\u6539\u9020\u540e&#xff1a;<\/p>\n<ul>\n<li>\u4e24\u53f0 Tomcat \u5206\u62c5\u52a8\u6001\u8bf7\u6c42\u538b\u529b<\/li>\n<li>Nginx \u76f4\u63a5\u5904\u7406\u9759\u6001\u8d44\u6e90&#xff0c;Tomcat CPU \u4e0b\u964d\u7ea6 30%<\/li>\n<li>\u5f00\u542f Gzip \u540e&#xff0c;\u9759\u6001\u8d44\u6e90\u4f53\u79ef\u51cf\u5c11 60%-70%<\/li>\n<li>\u5355\u53f0 Tomcat \u6302\u6389\u65f6&#xff0c;Nginx \u81ea\u52a8\u628a\u6d41\u91cf\u5207\u5230\u53e6\u4e00\u53f0&#xff0c;\u670d\u52a1\u4e0d\u4e2d\u65ad<\/li>\n<\/ul>\n<p>\u867d\u7136\u67b6\u6784\u8fd8\u662f\u5f88\u7b80\u5355&#xff0c;\u4f46\u5bf9\u4e8e\u4e2d\u5c0f\u578b\u9879\u76ee\u6765\u8bf4&#xff0c;\u8fd9\u5957\u65b9\u6848\u6027\u4ef7\u6bd4\u6781\u9ad8&#xff0c;\u82b1\u534a\u5929\u65f6\u95f4\u914d\u7f6e&#xff0c;\u80fd\u6362\u6765\u5f88\u957f\u4e00\u6bb5\u65f6\u95f4\u7684\u5b89\u7a33 sleep\u3002<\/p>\n<hr \/>\n<h3>\u603b\u7ed3<\/h3>\n<p>\u4eca\u5929\u54b1\u4eec\u804a\u4e86\u600e\u4e48\u7528 Nginx \u89e3\u51b3&#034;\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f&#034;\u7684\u95ee\u9898&#xff1a;<\/p>\n<li>\u53cd\u5411\u4ee3\u7406\u5c31\u50cf\u662f\u9910\u5385\u95e8\u53e3\u7684\u670d\u52a1\u5458&#xff0c;\u7528\u6237\u53ea\u8ddf Nginx \u6253\u4ea4\u9053&#xff0c;\u540e\u7aef Tomcat \u88ab\u9690\u85cf\u8d77\u6765<\/li>\n<li>\u8d1f\u8f7d\u5747\u8861\u8ba9\u591a\u53f0 Tomcat \u4e00\u8d77\u5e72\u6d3b&#xff0c;\u7b56\u7565\u6709\u8f6e\u8be2\u3001\u6743\u91cd\u3001ip_hash\u3001least_conn&#xff0c;\u6309\u9700\u9009\u62e9<\/li>\n<li>\u9759\u6001\u8d44\u6e90\u5206\u79bb\u80fd\u663e\u8457\u51cf\u8f7b Tomcat \u8d1f\u62c5&#xff0c;\u8ba9\u4e13\u4e1a\u7684\u4eba\u5e72\u4e13\u4e1a\u7684\u4e8b<\/li>\n<li>Gzip \u538b\u7f29\u548c HTTPS \u914d\u7f6e\u662f\u73b0\u4ee3 Web \u670d\u52a1\u7684\u57fa\u672c\u64cd\u4f5c<\/li>\n<li>\u9650\u6d41\u9632\u5237\u80fd\u7ed9\u7cfb\u7edf\u52a0\u4e00\u9053\u4fdd\u9669\u6760&#xff0c;\u9632\u6b62\u88ab\u6076\u610f\u6d41\u91cf\u51b2\u57ae<\/li>\n<p>\u5f53\u7136&#xff0c;\u8fd9\u5957\u65b9\u6848\u4e5f\u4e0d\u662f\u94f6\u5f39\u3002\u5982\u679c\u4e1a\u52a1\u91cf\u7ee7\u7eed\u589e\u957f&#xff0c;\u540e\u9762\u4f60\u53ef\u80fd\u8fd8\u8981\u5f15\u5165 Redis \u505a\u5206\u5e03\u5f0f Session\u3001\u7528 Consul \u505a\u670d\u52a1\u53d1\u73b0\u3001\u4e0a Kubernetes \u505a\u5bb9\u5668\u7f16\u6392\u2026\u2026\u4f46\u90a3\u662f\u540e\u8bdd\u4e86\u3002<\/p>\n<p>\u5343\u91cc\u4e4b\u884c&#xff0c;\u59cb\u4e8e\u4e00\u4e2a\u9760\u8c31\u7684 Nginx \u914d\u7f6e\u3002<\/p>\n<hr \/>\n<p>\u4f60\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u662f\u600e\u4e48\u505a\u8d1f\u8f7d\u5747\u8861\u7684&#xff1f;\u7528\u8fc7 Nginx \u7684\u54ea\u4e9b\u9ad8\u7ea7\u529f\u80fd&#xff1f;\u6216\u8005\u8e29\u8fc7\u4ec0\u4e48\u66f4\u5947\u8469\u7684\u5751&#xff1f;\u6b22\u8fce\u5728\u8bc4\u8bba\u533a\u4ea4\u6d41&#xff0c;\u54b1\u4eec\u4e00\u8d77\u8fdb\u6b65&#xff01;<\/p>\n<p>\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u5bf9\u4f60\u6709\u5e2e\u52a9&#xff0c;\u70b9\u4e2a\u8d5e\u518d\u8d70\u5457~ &#x1f37b;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>devops\u7cfb\u5217(\u4e00)  Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861&#xff1a;\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e<br \/>\n\u95ee\u9898\u5f15\u5165&#xff1a;\u534a\u591c\u88ab\u62a5\u8b66\u77ed\u4fe1\u70b8\u9192\u7684\u6ecb\u5473<br \/>\n\u4e0a\u4e2a\u6708\u6709\u4e2a\u5468\u4e09&#xff0c;\u51cc\u6668\u4e24\u70b9&#xff0c;\u6211\u88ab\u9489\u9489\u62a5\u8b66\u9707\u9192\u4e86\u3002<br \/>\n\u6253\u5f00\u624b\u673a\u4e00\u770b&#xff0c;\u5168\u662f \u201cTomcat \u54cd\u5e94\u8d85\u65f6\u201d\u3001\u201c\u63a5\u53e3 504 Gateway Timeout\u201d \u7684\u544a\u8b66\u3002\u516c\u53f8\u4e1a\u52a1\u6700\u8fd1\u63a8\u5e7f\u4e86\u4e00\u6ce2&#xff0c;\u65e5\u6d3b\u4ece\u51e0\u5343\u8e6d\u8e6d\u6da8\u5230\u4e86\u51e0\u4e07&#xff0c;\u7ed3\u679c\u90a3\u53f0\u5b64\u96f6\u96f6\u7684 Tomcat \u670d\u52a1\u5668\u5f00\u59cb\u625b\u4e0d\u4f4f\u4e86\u3002<br \/>\n\u767d\u5929\u7528<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[117],"topic":[],"class_list":["post-82346","post","type-post","status-publish","format-standard","hentry","category-server","tag-nginx"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/82346.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861&#xff1a;\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e \u95ee\u9898\u5f15\u5165&#xff1a;\u534a\u591c\u88ab\u62a5\u8b66\u77ed\u4fe1\u70b8\u9192\u7684\u6ecb\u5473 \u4e0a\u4e2a\u6708\u6709\u4e2a\u5468\u4e09&#xff0c;\u51cc\u6668\u4e24\u70b9&#xff0c;\u6211\u88ab\u9489\u9489\u62a5\u8b66\u9707\u9192\u4e86\u3002 \u6253\u5f00\u624b\u673a\u4e00\u770b&#xff0c;\u5168\u662f \u201cTomcat \u54cd\u5e94\u8d85\u65f6\u201d\u3001\u201c\u63a5\u53e3 504 Gateway Timeout\u201d \u7684\u544a\u8b66\u3002\u516c\u53f8\u4e1a\u52a1\u6700\u8fd1\u63a8\u5e7f\u4e86\u4e00\u6ce2&#xff0c;\u65e5\u6d3b\u4ece\u51e0\u5343\u8e6d\u8e6d\u6da8\u5230\u4e86\u51e0\u4e07&#xff0c;\u7ed3\u679c\u90a3\u53f0\u5b64\u96f6\u96f6\u7684 Tomcat \u670d\u52a1\u5668\u5f00\u59cb\u625b\u4e0d\u4f4f\u4e86\u3002 \u767d\u5929\u7528\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/82346.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-25T00:02:47+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82346.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/82346.html\",\"name\":\"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-25T00:02:47+00:00\",\"dateModified\":\"2026-07-25T00:02:47+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/82346.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/82346.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/82346.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/82346.html","og_locale":"zh_CN","og_type":"article","og_title":"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861&#xff1a;\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e \u95ee\u9898\u5f15\u5165&#xff1a;\u534a\u591c\u88ab\u62a5\u8b66\u77ed\u4fe1\u70b8\u9192\u7684\u6ecb\u5473 \u4e0a\u4e2a\u6708\u6709\u4e2a\u5468\u4e09&#xff0c;\u51cc\u6668\u4e24\u70b9&#xff0c;\u6211\u88ab\u9489\u9489\u62a5\u8b66\u9707\u9192\u4e86\u3002 \u6253\u5f00\u624b\u673a\u4e00\u770b&#xff0c;\u5168\u662f \u201cTomcat \u54cd\u5e94\u8d85\u65f6\u201d\u3001\u201c\u63a5\u53e3 504 Gateway Timeout\u201d \u7684\u544a\u8b66\u3002\u516c\u53f8\u4e1a\u52a1\u6700\u8fd1\u63a8\u5e7f\u4e86\u4e00\u6ce2&#xff0c;\u65e5\u6d3b\u4ece\u51e0\u5343\u8e6d\u8e6d\u6da8\u5230\u4e86\u51e0\u4e07&#xff0c;\u7ed3\u679c\u90a3\u53f0\u5b64\u96f6\u96f6\u7684 Tomcat \u670d\u52a1\u5668\u5f00\u59cb\u625b\u4e0d\u4f4f\u4e86\u3002 \u767d\u5929\u7528","og_url":"https:\/\/www.wsisp.com\/helps\/82346.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-25T00:02:47+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/82346.html","url":"https:\/\/www.wsisp.com\/helps\/82346.html","name":"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-25T00:02:47+00:00","dateModified":"2026-07-25T00:02:47+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/82346.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/82346.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/82346.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"devops\u7cfb\u5217(\u4e00) Nginx \u53cd\u5411\u4ee3\u7406\u4e0e\u8d1f\u8f7d\u5747\u8861\uff1a\u4e00\u53f0\u670d\u52a1\u5668\u625b\u4e0d\u4f4f\u600e\u4e48\u529e"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82346","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=82346"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/82346\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=82346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=82346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=82346"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=82346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}