{"id":116641,"date":"2026-10-21T23:49:13","date_gmt":"2026-10-21T15:49:13","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/116641.html"},"modified":"2026-10-21T23:49:13","modified_gmt":"2026-10-21T15:49:13","slug":"%e7%bd%91%e7%ab%99%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%bc%82%e5%b8%b8%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f%e4%ba%94%e4%b8%aa-5xx-%e5%9c%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e9%87%8c%e9%95%bf%e5%be%97%e4%b8%80","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/116641.html","title":{"rendered":"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c"},"content":{"rendered":"<p>        \/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/<br \/>\n        #content_views .toc,<br \/>\n        \/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/<br \/>\n        #content_views.markdown_views &gt; p:empty:has(+ .toc),<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty,<br \/>\n        \/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/<br \/>\n        #content_views.htmledit_views #main-toc,<br \/>\n        #content_views.htmledit_views #hr-toc,<br \/>\n        #content_views.htmledit_views p[id*=\\&#8221;-toc\\&#8221;] {<br \/>\n          display: none !important;<br \/>\n        }<br \/>\n        \/* \u76ee\u5f55\u53bb\u6389\u540e\uff0c\u7d27\u8ddf\u7684\u9996\u4e2a\u6807\u9898\u4e0d\u518d\u591a\u51fa\u4e00\u5757\u4e0a\u8fb9\u8ddd *\/<br \/>\n        #content_views.markdown_views &gt; .toc + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + h4,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h1,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h2,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h3,<br \/>\n        #content_views.markdown_views &gt; .toc + p:empty + h4 {<br \/>\n          margin-top: 0 !important;<br \/>\n        }<\/p>\n<p>\u4e0a\u5468\u5e2e\u4eba\u770b\u4e00\u53f0\u673a\u5668&#xff0c;\u53cd\u9988\u662f&#034;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38&#034;\u3002\u6211\u6253\u5f00\u6d4f\u89c8\u5668\u4e00\u770b&#xff0c;\u767d\u5e95\u9ed1\u5b57\u4e00\u884c 502 Bad Gateway&#xff0c;\u9875\u9762\u8fd8\u6709\u4e2a nginx \u7684\u7248\u672c\u53f7\u3002\u4ed6\u5df2\u7ecf\u5728\u63a7\u5236\u53f0\u91cd\u542f\u8fc7\u4e24\u6b21\u4e86&#xff0c;\u6ca1\u7528\u3002<\/p>\n<p>\u6211\u6ca1\u6025\u7740\u91cd\u542f&#xff0c;\u5148\u6572\u4e86 tail -50 \/var\/log\/nginx\/error.log\u3002\u7b2c\u4e00\u884c\u5c31\u5199\u7740 *37 connect() failed (111: Connection refused) while connecting to upstream&#xff0c;upstream \u6307\u5411\u7684\u662f 127.0.0.1:9000\u3002PHP-FPM \u6ca1\u8d77\u6765\u3002 \u4ece\u770b\u5230\u65e5\u5fd7\u5230\u4fee\u597d&#xff0c;\u56db\u5206\u949f\u3002<\/p>\n<p>\u8fd9\u5c31\u662f\u672c\u6587\u60f3\u8bb2\u6e05\u695a\u7684\u90a3\u4ef6\u4e8b&#xff1a;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\u8fd9\u4e2a\u95ee\u9898\u7684\u7b54\u6848&#xff0c;\u51e0\u4e4e\u4ece\u4e0d\u53d6\u51b3\u4e8e\u6d4f\u89c8\u5668\u4e0a\u90a3\u4e2a\u6570\u5b57&#xff0c;\u800c\u53d6\u51b3\u4e8e error_log \u91cc\u90a3\u4e00\u884c\u82f1\u6587\u3002 \u540c\u4e00\u4e2a 502&#xff0c;\u4e94\u79cd\u4e0d\u540c\u7684\u65e5\u5fd7\u539f\u6587&#xff0c;\u5bf9\u5e94\u4e94\u4e2a\u5b8c\u5168\u4e0d\u540c\u3001\u4e14\u4e92\u4e0d\u642d\u754c\u7684\u4fee\u6cd5\u3002<\/p>\n<p>\u6211\u81ea\u5df1\u5728\u6392\u969c\u65f6\u6709\u4e2a\u4e60\u60ef&#xff1a;\u9047\u5230 5xx&#xff0c;\u7b2c\u4e00\u53cd\u5e94\u4e0d\u662f\u731c&#xff0c;\u662f\u628a\u90a3\u4e00\u884c\u65e5\u5fd7\u539f\u6587\u6284\u4e0b\u6765\u3002\u6284\u5b8c\u518d\u53bb\u67e5\u8868\u2014\u2014\u56e0\u4e3a nginx \u5df2\u7ecf\u628a\u7b54\u6848\u5199\u51fa\u6765\u4e86&#xff0c;\u53ea\u662f\u5b83\u7528\u7684\u662f\u81ea\u5df1\u7684\u8bed\u8a00\u3002<\/p>\n<p>\u6bcf\u6b21\u6709\u4eba\u95ee \u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e&#xff0c;\u6211\u90fd\u4f1a\u5148\u628a\u8fd9\u4e2a\u4e60\u60ef\u585e\u7ed9\u4ed6&#xff1a;\u56e0\u4e3a\u540c\u4e00\u4e2a\u72b6\u6001\u7801\u5e95\u4e0b\u538b\u7740\u81f3\u5c11\u4e94\u79cd\u4e92\u4e0d\u76f8\u5e72\u7684\u75c5\u56e0&#xff0c;\u9760\u731c\u4e00\u5b9a\u4f1a\u8d70\u9519\u8def\u3002<\/p>\n<hr \/>\n<h3>\u4e00\u3001\u5148\u628a&#034;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38&#034;\u8fd9\u4e2a\u8bcd\u62c6\u5f00<\/h3>\n<p>\u8fd9\u4e2a\u8bcd\u5728\u65e5\u5e38\u53cd\u9988\u91cc\u88ab\u7528\u5f97\u592a\u5bbd\u4e86&#xff0c;\u6211\u4e00\u822c\u5148\u628a\u5b83\u780d\u6210\u4e09\u7c7b&#xff0c;\u56e0\u4e3a\u5b83\u4eec\u8d70\u7684\u662f\u5b8c\u5168\u4e0d\u540c\u7684\u6392\u67e5\u8def\u5f84&#xff1a;<\/p>\n<table>\n<tr>\u4f60\u770b\u5230\u7684\u73b0\u8c61\u5927\u6982\u7387\u5728\u54ea\u4e00\u5c42\u8be5\u53bb\u54ea\u91cc\u627e\u8bc1\u636e<\/tr>\n<tbody>\n<tr>\n<td>\u767d\u5c4f \/ \u8d85\u65f6 \/ \u201c\u65e0\u6cd5\u8bbf\u95ee\u6b64\u7f51\u7ad9\u201d<\/td>\n<td>\u94fe\u8def\u5c42&#xff0c;\u8bf7\u6c42\u8fd8\u6ca1\u5230 nginx<\/td>\n<td>33 \u7bc7\u8bb2\u7684\u90a3\u4e09\u5c42&#xff1a;\u5b89\u5168\u7ec4\u3001\u7cfb\u7edf\u9632\u706b\u5899\u3001\u8fdb\u7a0b\u7aef\u53e3<\/td>\n<\/tr>\n<tr>\n<td>\u6709 HTTP \u6570\u5b57&#xff1a;500\/502\/503\/504<\/td>\n<td>\u5230\u8fbe\u4e86 nginx&#xff0c;\u5361\u5728\u5b83\u540e\u9762<\/td>\n<td>nginx \u7684 error_log<\/td>\n<\/tr>\n<tr>\n<td>\u6d4f\u89c8\u5668\u7ea2\u9501 \/ ERR_CERT_DATE_INVALID<\/td>\n<td>TLS \u5c42&#xff0c;\u6ca1\u6709 HTTP \u72b6\u6001\u7801<\/td>\n<td>\u8bc1\u4e66\u6709\u6548\u671f\u4e0e\u670d\u52a1\u5668\u65f6\u95f4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e2d\u95f4\u90a3\u4e00\u7c7b\u624d\u662f\u672c\u6587\u7684\u8303\u56f4&#xff1a;\u8bf7\u6c42\u5230\u4e86 nginx&#xff0c;\u4f46 nginx \u6ca1\u80fd\u4ece\u5b83\u80cc\u540e\u90a3\u4e2a\u8fdb\u7a0b\u62ff\u5230\u4e00\u4e2a\u80fd\u7528\u7684\u54cd\u5e94\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u8981\u628a\u8fb9\u754c\u5212\u8fd9\u4e48\u6b7b&#xff1f;\u56e0\u4e3a\u7b2c\u4e00\u7c7b\u548c\u7b2c\u4e09\u7c7b\u5982\u679c\u6309 502 \u7684\u601d\u8def\u53bb\u67e5&#xff0c;\u4f1a\u67e5\u5f88\u4e45\u4e14\u6beb\u65e0\u6536\u83b7\u2014\u2014\u5b83\u4eec\u7684\u9519\u8bef\u6839\u672c\u4e0d\u5728 nginx \u7684\u65e5\u5fd7\u91cc\u3002<\/p>\n<p>\u6309 MDN \u7684\u5b9a\u4e49&#xff0c;502 \u7684\u542b\u4e49\u662f&#034;\u670d\u52a1\u5668\u4f5c\u4e3a\u7f51\u5173\u6216\u4ee3\u7406&#xff0c;\u4ece\u4e0a\u6e38\u670d\u52a1\u5668\u6536\u5230\u4e86\u65e0\u6548\u54cd\u5e94&#034;\u3002\u6ce8\u610f\u8fd9\u4e2a\u5b9a\u4e49\u7684\u4e3b\u8bed&#xff1a;\u662f nginx \u6536\u5230\u4e86\u65e0\u6548\u54cd\u5e94&#xff0c;\u6216\u8005\u662f\u538b\u6839\u6ca1\u6536\u5230\u3002 \u5b83\u81ea\u5df1\u597d\u5f97\u5f88\u3002<\/p>\n<p>\u60f3\u660e\u767d\u8fd9\u4e00\u70b9\u5f88\u91cd\u8981&#xff1a;5xx \u4ece\u6765\u4e0d\u662f&#034;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38&#034;&#xff0c;\u800c\u662f&#034;nginx \u4e4b\u540e\u7684\u90a3\u4e00\u53f0\u5f02\u5e38&#034;&#xff0c;\u800c\u90a3\u4e00\u53f0\u53ef\u80fd\u5c31\u5728\u540c\u4e00\u53f0\u673a\u5668\u7684\u53e6\u4e00\u4e2a\u7aef\u53e3\u4e0a\u3002<\/p>\n<hr \/>\n<h3>\u4e8c\u3001\u552f\u4e00\u9760\u8c31\u7684\u5224\u51b3\u4e66&#xff1a;error_log&#xff0c;\u4e0d\u662f access_log<\/h3>\n<p>\u8fd9\u91cc\u6709\u4e2a\u5751&#xff1a;\u7edd\u5927\u591a\u6570\u4eba\u7b2c\u4e00\u53cd\u5e94\u662f\u53bb\u7ffb access_log&#xff0c;\u4f46\u90a3\u91cc\u9762\u53ea\u6709\u7ed3\u679c&#xff0c;\u6ca1\u6709\u539f\u56e0\u3002<\/p>\n<p>access_log \u91cc\u4e00\u884c 502 \u957f\u8fd9\u6837&#xff1a;<\/p>\n<p>116.62.x.x &#8211; &#8211; [12\/Oct\/2026:09:14:22 &#043;0800] &#034;GET \/api\/order HTTP\/1.1&#034; 502 150 &#034;-&#034; &#034;Mozilla\/5.0 &#8230;&#034;<\/p>\n<p>\u80fd\u770b\u51fa\u7684\u53ea\u6709&#034;\u8fd9\u4e2a\u8bf7\u6c42\u8fd4\u56de\u4e86 502&#034;\u3002\u4e3a\u4ec0\u4e48\u8fd4\u56de&#xff0c;\u4e00\u4e2a\u5b57\u90fd\u6ca1\u6709\u3002<\/p>\n<p>error_log \u91cc\u5bf9\u5e94\u65f6\u523b\u7684\u90a3\u4e00\u884c\u624d\u662f\u7b54\u6848&#xff1a;<\/p>\n<p>2026\/10\/12 09:14:22 [error] 2841#0: *137 connect() failed (111: Connection refused) while connecting to upstream,<br \/>\nclient: 116.62.x.x, server: demo.example.com, request: &#034;GET \/api\/order HTTP\/1.1&#034;,<br \/>\nupstream: &#034;http:\/\/127.0.0.1:9000\/api\/order&#034;, host: &#034;demo.example.com&#034;<\/p>\n<p>\u5173\u952e\u5728\u4e2d\u95f4\u90a3\u6bb5 connect() failed (111: Connection refused)\u3002\u8fd9\u5c31\u662f\u5168\u6587\u8981\u62c6\u89e3\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u5b9e\u64cd\u4e0a\u6211\u4e00\u822c\u7528\u8fd9\u6761&#xff0c;\u628a\u65f6\u95f4\u8303\u56f4\u5185\u7684\u9519\u8bef\u62c9\u51fa\u6765&#xff1a;<\/p>\n<p><span class=\"token comment\"># \u6700\u8fd1 200 \u884c\u9519\u8bef\u65e5\u5fd7&#xff08;\u9ed8\u8ba4\u7ea7\u522b error&#xff0c;5xx \u90fd\u4f1a\u843d\u8fdb\u6765&#xff09;<\/span><br \/>\n<span class=\"token function\">tail<\/span> <span class=\"token parameter variable\">-200<\/span> \/var\/log\/nginx\/error.log<\/p>\n<p><span class=\"token comment\"># \u6216\u8005\u76ef\u7740\u5237&#xff0c;\u53e6\u4e00\u8fb9\u590d\u73b0\u95ee\u9898<\/span><br \/>\n<span class=\"token function\">tail<\/span> <span class=\"token parameter variable\">-f<\/span> \/var\/log\/nginx\/error.log<\/p>\n<p>\u53e6\u5916\u63d0\u4e00\u53e5\u5bb9\u6613\u6df7\u6dc6\u7684&#xff1a;upstream: \u5b57\u6bb5\u663e\u793a\u7684\u662f nginx \u5f53\u65f6\u8bd5\u56fe\u53bb\u8fde\u7684\u90a3\u4e2a\u5730\u5740&#xff0c;\u4e0d\u662f&#034;\u540e\u7aef\u771f\u5b9e\u5730\u5740&#034;\u3002\u5982\u679c upstream \u5757\u91cc\u914d\u4e86\u57df\u540d&#xff0c;\u8fd9\u91cc\u663e\u793a\u7684\u662f\u89e3\u6790\u540e\u7684 IP\u2014\u2014\u5148\u770b\u6e05\u695a\u5b83\u662f\u4e0d\u662f\u4f60\u4ee5\u4e3a\u7684\u90a3\u4e2a IP&#xff0c;\u518d\u5f80\u4e0b\u6392\u67e5\u3002<\/p>\n<hr \/>\n<h3>\u4e09\u3001connect() failed (111: Connection refused) \u2014\u2014 \u540e\u7aef\u6839\u672c\u6ca1\u5728\u542c<\/h3>\n<p>\u8fd9\u662f\u6700\u5e38\u89c1\u7684\u4e00\u79cd&#xff0c;\u4e5f\u662f\u6700\u5bb9\u6613\u4fee\u7684\u4e00\u79cd\u3002\u542b\u4e49\u5f88\u76f4\u767d&#xff1a;nginx \u53bb\u6572\u95e8&#xff0c;\u95e8\u540e\u9762\u6ca1\u4eba\u5e94&#xff0c;\u5bf9\u65b9\u76f4\u63a5\u56de\u4e86\u4e2a&#034;\u6eda&#034;\u3002<\/p>\n<p>\u4e09\u4e2a\u6700\u5e38\u89c1\u6765\u6e90&#xff0c;\u6211\u6309\u51fa\u73b0\u9891\u7387\u6392&#xff1a;<\/p>\n<p>1&#xff09;\u540e\u7aef\u8fdb\u7a0b\u538b\u6839\u6ca1\u8d77\u6765\u3002 PHP-FPM \u5d29\u4e86\u3001Node \u8fdb\u7a0b\u88ab OOM \u6740\u4e86\u3001Java \u90e8\u7f72\u5b8c\u8fd8\u6ca1\u8d77\u6765\u3002\u67e5\u7684\u65b9\u6cd5\u5f88\u673a\u68b0&#xff1a;<\/p>\n<p><span class=\"token function\">ps<\/span> aux <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token parameter variable\">-E<\/span> <span class=\"token string\">&#039;php-fpm|node|java&#039;<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token parameter variable\">-v<\/span> <span class=\"token function\">grep<\/span><br \/>\nss <span class=\"token parameter variable\">-tlnp<\/span> <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token parameter variable\">-E<\/span> <span class=\"token string\">&#039;:9000|:8080&#039;<\/span>    <span class=\"token comment\"># \u6362\u6210\u4f60 proxy_pass \u91cc\u90a3\u4e2a\u7aef\u53e3<\/span><\/p>\n<p>\u5982\u679c ss \u67e5\u4e0d\u5230\u4efb\u4f55\u76d1\u542c&#xff0c;\u90a3\u5c31\u4e0d\u662f nginx \u7684\u95ee\u9898\u3002<\/p>\n<p>2&#xff09;\u7aef\u53e3\u5199\u9519\u4e86\u3002 \u8fd9\u4e2a\u6211\u81ea\u5df1\u4e5f\u72af\u8fc7&#xff1a;\u914d\u7f6e\u91cc\u5199 proxy_pass http:\/\/127.0.0.1:8080;&#xff0c;\u5b9e\u9645\u670d\u52a1\u76d1\u542c\u7684\u662f 9000\u3002nginx \u914d\u7f6e\u8bed\u6cd5\u5b8c\u5168\u5408\u6cd5&#xff0c;nginx -t \u4e5f\u4e0d\u4f1a\u62a5\u9519\u2014\u2014\u5b83\u6ca1\u6cd5\u66ff\u4f60\u9a8c\u8bc1\u7aef\u53e3\u80cc\u540e\u6709\u6ca1\u6709\u4eba\u3002<\/p>\n<p>3&#xff09;\u7528 UNIX socket \u65f6\u6587\u4ef6\u4e0d\u5728\u4e86\u3002 PHP-FPM \u5d29\u6389\u65f6&#xff0c;socket \u6587\u4ef6\u4f1a\u6d88\u5931&#xff0c;connect() \u76f4\u63a5\u5931\u8d25\u3002<\/p>\n<p>\u5feb\u901f\u9a8c\u8bc1\u7684\u9ec4\u91d1\u4e00\u6761&#xff1a;\u5728\u670d\u52a1\u5668\u672c\u673a\u76f4\u63a5\u8bf7\u6c42\u90a3\u4e2a\u540e\u7aef&#xff0c;\u7ed5\u8fc7 nginx\u3002<\/p>\n<p>\u8fd9\u4e00\u6b65\u770b\u7740\u7b80\u5355&#xff0c;\u4f46\u5b83\u628a \u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e \u8fd9\u4e2a\u5927\u95ee\u9898\u5207\u6210\u4e86\u4e00\u534a&#xff1a;\u672c\u673a\u901a\u3001\u5916\u9762\u4e0d\u901a&#xff0c;\u95ee\u9898\u5728 nginx \u5230\u540e\u7aef\u8fd9\u4e00\u6bb5\u914d\u7f6e&#xff1b;\u672c\u673a\u90fd\u4e0d\u901a&#xff0c;\u90a3\u5c31\u662f\u540e\u7aef\u81ea\u5df1\u7684\u4e8b&#xff0c;\u4e0d\u7528\u518d\u78b0 nginx \u4e00\u884c\u914d\u7f6e\u3002\u6211\u6bcf\u6b21\u90fd\u5148\u505a\u8fd9\u4e00\u6b65&#xff0c;\u5b83\u80fd\u7acb\u523b\u628a\u8d23\u4efb\u5207\u5f00&#xff0c;\u907f\u514d\u5728\u9519\u8bef\u7684\u65b9\u5411\u4e0a\u67e5\u534a\u5c0f\u65f6\u3002<\/p>\n<hr \/>\n<h3>\u56db\u3001no live upstreams while connecting to upstream \u2014\u2014 \u540e\u7aef\u662f\u597d\u7684&#xff0c;\u88ab nginx \u81ea\u5df1\u62c9\u9ed1\u4e86<\/h3>\n<p>\u8fd9\u6761\u6700\u6709\u8ff7\u60d1\u6027\u3002\u4f60\u53bb\u540e\u7aef\u673a\u5668\u4e0a\u770b\u5230\u8fdb\u7a0b\u597d\u597d\u7684&#xff0c;curl \u4e5f\u6b63\u5e38&#xff0c;\u4f46 nginx \u5c31\u662f\u62a5 502\u3002<\/p>\n<p>\u539f\u56e0\u662f nginx \u7684\u88ab\u52a8\u5065\u5eb7\u68c0\u67e5\u628a\u8fd9\u53f0\u673a\u5668\u6807\u8bb0\u4e3a\u4e0d\u53ef\u7528\u4e86\u3002<\/p>\n<p>\u6309 nginx \u5b98\u65b9 ngx_http_upstream_module \u624b\u518c \u7684\u539f\u6587&#xff0c;\u9ed8\u8ba4\u53c2\u6570\u662f&#xff1a;<\/p>\n<p>\u201cBy default, the number of unsuccessful attempts is set to 1.\u201d&#xff08;max_fails&#xff09; \u201cBy default, the parameter is set to 10 seconds.\u201d&#xff08;fail_timeout&#xff09;<\/p>\n<p>\u7ffb\u8bd1\u8fc7\u6765\u5c31\u662f&#xff1a;\u53ea\u8981\u5931\u8d25 1 \u6b21&#xff0c;\u8fd9\u53f0\u540e\u7aef\u5c31\u88ab\u62c9\u9ed1 10 \u79d2\u3002<\/p>\n<p>\u60f3\u60f3\u8fd9\u5bf9\u4e00\u53f0\u5076\u53d1\u6296\u52a8\u7684\u670d\u52a1\u610f\u5473\u7740\u4ec0\u4e48\u2014\u2014\u4e00\u6b21\u7f51\u7edc\u6296\u52a8&#xff0c;\u8fd9\u53f0\u5c31\u88ab\u6458 10 \u79d2\u3002\u5982\u679c\u662f\u5355\u53f0 upstream&#xff0c;\u90a3\u8fd9 10 \u79d2\u91cc\u7528\u6237\u770b\u5230\u7684\u5168\u662f 502&#xff0c;\u800c\u4f60\u53bb\u67e5\u7684\u65f6\u5019\u53ef\u80fd\u521a\u597d\u8fc7\u5b8c&#xff0c;\u4e00\u5207&#034;\u770b\u8d77\u6765\u90fd\u6b63\u5e38&#034;\u3002\u8fd9\u5c31\u662f\u6240\u8c13&#034;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u56de\u4e8b\u3001\u5237\u65b0\u4e00\u4e0b\u53c8\u597d\u4e86&#034;\u7684\u5178\u578b\u6210\u56e0\u3002<\/p>\n<p>\u540c\u4e00\u4efd\u624b\u518c\u8fd8\u5199\u4e86 nginx \u5728\u5168\u90e8\u5931\u8d25\u65f6\u7684\u884c\u4e3a&#xff1a;<\/p>\n<p>\u201cIf an error occurs during communication with a server, the request will be passed to the next server\u2026 If a successful response could not be obtained from any of the servers, the client will receive the result of the communication with the last server.\u201d<\/p>\n<p>\u6240\u4ee5\u6709\u6ca1\u6709\u4e0b\u4e00\u53f0&#xff0c;\u7ed3\u5c40\u5b8c\u5168\u4e0d\u540c\u3002\u6211\u7684\u5efa\u8bae\u662f\u522b\u52a8 max_fails \u7684\u9ed8\u8ba4\u884c\u4e3a&#xff0c;\u800c\u662f&#xff1a;<\/p>\n<p>upstream backend {<br \/>\n    server 10.0.0.11:8080 max_fails&#061;3 fail_timeout&#061;30s;<br \/>\n    server 10.0.0.12:8080 max_fails&#061;3 fail_timeout&#061;30s;<br \/>\n    keepalive 32;<br \/>\n}<\/p>\n<p>\u6539\u5b8c\u8bb0\u5f97 nginx -t \u518d nginx -s reload\u3002\u987a\u5e26\u8bf4\u4e00\u53e5&#xff0c;keepalive 32 \u8fd9\u884c\u770b\u7740\u65e0\u5173\u7d27\u8981&#xff0c;\u4f46\u5b83\u80fd\u663e\u8457\u51cf\u5c11 nginx \u4e0e\u540e\u7aef\u4e4b\u95f4\u53cd\u590d\u63e1\u624b\u5e26\u6765\u7684\u5931\u8d25\u6982\u7387\u3002<\/p>\n<hr \/>\n<h3>\u4e94\u3001upstream timed out (110: Connection timed out) \u2014\u2014 \u540e\u7aef\u6d3b\u7740&#xff0c;\u53ea\u662f\u6162<\/h3>\n<p>\u8fd9\u6761\u548c\u7b2c\u4e09\u6761\u7684\u533a\u522b\u662f\u6839\u672c\u6027\u7684&#xff1a;connection refused \u662f&#034;\u6ca1\u4eba\u5e94&#034;&#xff0c;timed out \u662f&#034;\u6709\u4eba\u5e94\u4e86\u4f46\u534a\u5929\u4e0d\u8bf4\u8bdd&#034;\u3002<\/p>\n<p>\u89e6\u53d1\u5b83\u7684\u662f ngx_http_proxy_module \u91cc\u90a3\u4e09\u4e2a\u8d85\u65f6&#xff0c;\u5b98\u65b9\u624b\u518c\u7ed9\u7684\u9ed8\u8ba4\u503c\u6e05\u4e00\u8272\u662f 60 \u79d2&#xff1a;<\/p>\n<p>proxy_connect_timeout 60s;   # \u4e0e\u540e\u7aef\u5efa\u8fde\u6700\u591a\u7b49\u591a\u4e45<br \/>\nproxy_send_timeout    60s;   # \u5411\u540e\u7aef\u53d1\u9001\u8bf7\u6c42\u6700\u591a\u7b49\u591a\u4e45<br \/>\nproxy_read_timeout    60s;   # \u7b49\u540e\u7aef\u56de\u8bdd\u6700\u591a\u7b49\u591a\u4e45<\/p>\n<p>\u8fd9\u4e09\u4e2a\u91cc\u7edd\u5927\u591a\u6570\u573a\u666f\u53ea\u9700\u8981\u5173\u5fc3\u6700\u540e\u4e00\u4e2a proxy_read_timeout\u2014\u2014\u5b83\u662f&#034;\u540e\u7aef\u7b97\u591a\u4e45\u7b97\u8d85\u65f6&#034;\u90a3\u628a\u5c3a\u3002\u4e00\u4e2a\u62a5\u8868\u5bfc\u51fa\u8dd1\u4e86 90 \u79d2&#xff0c;nginx \u4f1a\u5728\u7b2c 60 \u79d2\u628a\u8fde\u63a5\u6390\u65ad&#xff0c;\u7136\u540e\u7ed9\u5ba2\u6237\u7aef\u8fd4\u56de 504\u3002<\/p>\n<p>\u8fd9\u91cc\u8981\u8bf4\u6e05\u695a\u4e00\u4e2a\u6982\u5ff5&#xff1a;504 Gateway Timeout \u548c 502 Bad Gateway \u662f\u4e24\u79cd\u4e0d\u540c\u7684\u5931\u8d25&#xff0c;\u867d\u7136\u7528\u6237\u770b\u90fd\u662f\u4e2a\u9519\u8bef\u9875&#xff1a;<\/p>\n<ul>\n<li>502&#xff1a;\u8fde\u63a5\u5c42\u9762\u5c31\u6ca1\u8c08\u6210<\/li>\n<li>504&#xff1a;\u8fde\u63a5\u8c08\u6210\u4e86&#xff0c;\u4f46\u540e\u7aef\u6ca1\u5728\u89c4\u5b9a\u65f6\u95f4\u5185\u628a\u8bdd\u8bf4\u5b8c<\/li>\n<\/ul>\n<p>\u6240\u4ee5 \u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u89e3\u51b3 \u8fd9\u4e2a\u95ee\u9898&#xff0c;\u5728\u6162\u7684\u573a\u666f\u4e0b\u7b54\u6848\u4e0d\u662f&#034;\u91cd\u542f&#034;&#xff0c;\u800c\u662f\u4e8c\u9009\u4e00&#xff1a;\u8981\u4e48\u8ba9\u540e\u7aef\u5feb\u8d77\u6765&#xff08;\u52a0\u7d22\u5f15\u3001\u52a0\u7f13\u5b58\u3001\u5f02\u6b65\u5316&#xff09;&#xff0c;\u8981\u4e48\u628a\u5c3a\u5b50\u8c03\u957f\u2014\u2014\u4f46\u7b2c\u516b\u6761\u6211\u4f1a\u8bf4&#xff0c;\u8c03\u957f\u5c3a\u5b50\u901a\u5e38\u662f\u4e2a\u574f\u4e3b\u610f\u3002<\/p>\n<hr \/>\n<h3>\u516d\u3001\u54cd\u5e94\u6536\u5230\u4e00\u534a\u5c31\u65ad\u4e86&#xff1a;\u53e6\u5916\u4e09\u6761\u65e5\u5fd7\u539f\u6587<\/h3>\n<p>\u8fd9\u4e00\u7ec4\u6211\u5408\u5e76\u8bb2&#xff0c;\u56e0\u4e3a\u5b83\u4eec\u90fd\u5c5e\u4e8e&#034;\u8fde\u63a5\u5efa\u7acb\u6210\u529f&#xff0c;\u4f46\u54cd\u5e94\u4e0d\u5403\u8fd9\u4e00\u5957&#034;&#xff1a;<\/p>\n<table>\n<tr>error_log \u539f\u6587\u5b9e\u9645\u53d1\u751f\u4e86\u4ec0\u4e48\u5f80\u54ea\u67e5<\/tr>\n<tbody>\n<tr>\n<td>upstream prematurely closed connection while reading response header<\/td>\n<td>\u540e\u7aef\u8fdb\u7a0b\u5728\u5904\u7406\u9014\u4e2d\u5d29\u4e86<\/td>\n<td>\u540e\u7aef\u81ea\u5df1\u7684\u65e5\u5fd7\u3001dmesg \u770b OOM<\/td>\n<\/tr>\n<tr>\n<td>recv() failed (104: Connection reset by peer) while reading response header<\/td>\n<td>\u540e\u7aef\u4e3b\u52a8\u53d1 RST \u65ad\u5f00<\/td>\n<td>\u540c\u4e0a&#xff0c;\u6216\u540e\u7aef\u6709\u8fde\u63a5\u6570\u9650\u5236<\/td>\n<\/tr>\n<tr>\n<td>upstream sent too big header while reading response header from upstream<\/td>\n<td>\u54cd\u5e94\u5934\u8d85\u8fc7 nginx \u7f13\u51b2\u533a<\/td>\n<td>\u8c03 proxy_buffer_size<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4e2d\u95f4\u90a3\u6761\u7279\u522b\u503c\u5f97\u7559\u610f&#xff1a;\u5982\u679c\u53ea\u6709\u90e8\u5206\u8bf7\u6c42\u51fa\u73b0\u3001\u4e14\u6ca1\u6709\u89c4\u5f8b&#xff0c;\u5927\u6982\u7387\u662f\u540e\u7aef\u5728\u67d0\u4e2a\u7279\u5b9a\u8f93\u5165\u4e0b\u5d29\u4e86\u3002\u8fd9\u65f6\u5019\u53bb\u7ffb\u540e\u7aef\u7684\u65e5\u5fd7\u7684\u65f6\u95f4\u70b9&#xff0c;\u6bd4\u5728 nginx \u8fd9\u8fb9\u53cd\u590d\u770b\u6709\u7528\u5f97\u591a\u3002<\/p>\n<p>\u7b2c\u4e09\u6761\u5219\u662f\u4e2a\u7eaf\u7cb9\u7684\u914d\u7f6e\u95ee\u9898&#xff0c;\u4e00\u6761\u5c31\u80fd\u89e3\u51b3&#xff1a;<\/p>\n<p>proxy_buffer_size       16k;<br \/>\nproxy_buffers           8 16k;<br \/>\nproxy_busy_buffers_size 32k;<\/p>\n<p>\u5178\u578b\u573a\u666f\u662f\u540e\u7aef\u5f80\u54cd\u5e94\u5934\u91cc\u585e\u4e86\u8d85\u957f\u7684 Set-Cookie \u6216\u8005\u4e00\u5806\u81ea\u5b9a\u4e49\u5934\u3002<\/p>\n<hr \/>\n<h3>\u4e03\u3001Permission denied &#8230; while connecting to upstream \u2014\u2014 UNIX socket \u7684\u6743\u9650<\/h3>\n<p>\u8fd9\u6761\u5728 PHP-FPM \u7528 socket \u6587\u4ef6\u65f6\u7279\u522b\u5e38\u89c1&#xff0c;\u65e5\u5fd7\u539f\u6587\u5927\u81f4\u662f&#xff1a;<\/p>\n<p>connect() to unix:\/run\/php\/php8.2-fpm.sock failed (13: Permission denied) while connecting to upstream<\/p>\n<p>(13: Permission denied) \u2014\u2014 \u4e0d\u662f\u7aef\u53e3\u4e0d\u901a&#xff0c;\u662f nginx \u90a3\u4e2a\u7528\u6237\u6253\u4e0d\u5f00\u8fd9\u4e2a socket \u6587\u4ef6\u3002<\/p>\n<p>\u5bf9\u8d26\u4e24\u8fb9\u5c31\u884c&#xff1a;nginx \u7684 user \u914d\u7f6e vs PHP-FPM \u6c60\u91cc\u7684 listen.owner \/ listen.group \/ listen.mode\u3002<\/p>\n<p><span class=\"token function\">ls<\/span> <span class=\"token parameter variable\">-l<\/span> \/run\/php\/php8.2-fpm.sock      <span class=\"token comment\"># \u770b\u5c5e\u4e3b\u548c\u6743\u9650\u4f4d<\/span><br \/>\n<span class=\"token function\">grep<\/span> <span class=\"token string\">&#039;^user&#039;<\/span> \/etc\/nginx\/nginx.conf   <span class=\"token comment\"># nginx \u8dd1\u5728\u54ea\u4e2a\u7528\u6237\u4e0b<\/span><\/p>\n<p>\u6211\u81ea\u5df1\u78b0\u5230\u8fc7\u4e00\u6b21\u66f4\u9690\u853d\u7684&#xff1a;\u4e0a\u5c42\u76ee\u5f55 \/run\/php \u6ca1\u6709\u6267\u884c\u6743\u9650&#xff0c;\u5bfc\u81f4 nginx \u8fde\u6587\u4ef6\u90fd\u6478\u4e0d\u5230\u3002\u6240\u4ee5\u6587\u4ef6\u6743\u9650\u5bf9\u8fd8\u4e0d\u591f&#xff0c;\u6574\u6761\u8def\u5f84\u90fd\u8981\u80fd\u8d70\u901a\u3002<\/p>\n<h4>\u53e6\u5916\u4e09\u79cd&#xff1a;\u5b83\u4eec\u6839\u672c\u4e0d\u4f1a\u51fa\u73b0\u5728 nginx \u65e5\u5fd7\u91cc<\/h4>\n<p>\u8bf4\u5230\u8fd9\u91cc\u5fc5\u987b\u8865\u4e00\u5757\u8fb9\u754c&#xff0c;\u56e0\u4e3a \u6709\u4e9b&#034;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38&#034;&#xff0c;nginx \u65e5\u5fd7\u91cc\u4e00\u884c\u90fd\u6ca1\u6709\u2014\u2014\u8bf7\u6c42\u538b\u6839\u6ca1\u5230 nginx\u3002<\/p>\n<p>1&#xff09;\u8d1f\u8f7d\u5747\u8861\u90a3\u4e00\u5c42\u76f4\u63a5\u8fd4\u56de\u7684\u3002 \u8fd9\u65f6\u5019 502 \u662f LB \u7ed9\u7684&#xff0c;\u4e0d\u662f nginx \u7ed9\u7684\u3002\u4e09\u5bb6\u4e91\u7684\u5224\u65ad\u601d\u8def\u4e00\u81f4&#xff1a;\u5bf9\u6bd4 LB \u8fd4\u56de\u7ed9\u5ba2\u6237\u7aef\u7684\u7801 \u4e0e \u540e\u7aef\u8fd4\u56de\u7ed9 LB \u7684\u7801\u3002<\/p>\n<p>\u6309 \u963f\u91cc\u4e91\u300aCLB\u5f02\u5e38\u72b6\u6001\u7801\u300b \u7684\u53e3\u5f84&#xff1a;\u82e5 status \u4e0e upstream_status \u76f8\u540c&#xff0c;\u8bf4\u660e\u662f LB \u900f\u4f20\u4e86\u540e\u7aef\u7684\u5f02\u5e38&#xff1b;\u82e5 upstream_status \u4e3a -&#xff0c;\u5219\u8fd9\u4e2a\u7801\u662f LB \u81ea\u5df1\u751f\u6210\u7684&#xff0c;\u5178\u578b\u7684\u662f&#034;\u5168\u90e8\u540e\u7aef\u5065\u5eb7\u68c0\u67e5\u5931\u8d25&#034;\u3002<\/p>\n<p>\u540c\u4e00\u4efd\u6587\u6863\u8fd8\u70b9\u4e86\u4e00\u4e2a\u9ad8\u9891\u5751&#xff1a;\u540e\u7aef ECS \u4e0a\u7684 iptables \u6216\u7b2c\u4e09\u65b9\u5b89\u5168\u8f6f\u4ef6\u62e6\u6389\u4e86 100.64.0.0\/10&#xff08;\u8fd9\u662f CLB \u4e0e\u540e\u7aef\u901a\u4fe1\u7528\u7684\u7f51\u6bb5&#xff09;&#xff0c;\u5065\u5eb7\u68c0\u67e5\u5c31\u4f1a\u5168\u90e8\u5931\u8d25&#xff0c;\u76f4\u63a5\u5bfc\u81f4 502\u3002\u8fd9\u4e00\u4e2a\u539f\u56e0\u6211\u89c1\u8fc7\u4e0d\u6b62\u4e09\u6b21\u3002<\/p>\n<p>\u817e\u8baf\u4e91\u300a\u5065\u5eb7\u68c0\u67e5\u5f02\u5e38\u6392\u67e5\u300b \u9664\u540c\u6e90\u7f51\u6bb5\u5916\u8fd8\u7ed9\u4e86\u4e2a\u5f88\u786c\u7684\u70b9&#xff1a;\u540c\u65f6\u5f00\u542f tcp_tw_recycle \u548c tcp_timestamps \u4f1a\u5bfc\u81f4\u5065\u5eb7\u68c0\u67e5\u5f02\u5e38&#xff0c;\u5efa\u8bae\u5173\u95ed tcp_tw_recycle\u3002\u8fd9\u6761\u5728\u8001\u6559\u7a0b\u91cc\u7ecf\u5e38\u88ab\u63a8\u8350&#034;\u4f18\u5316&#034;&#xff0c;\u5b9e\u9645\u662f\u9897\u96f7\u3002<\/p>\n<p>\u534e\u4e3a\u4e91\u300a\u5065\u5eb7\u68c0\u67e5\u5f02\u5e38\u6392\u67e5&#xff08;\u5171\u4eab\u578b&#xff09;\u300b \u660e\u786e\u5199\u4e86\u5b83\u90a3\u8fb9\u7684\u6e90\u5730\u5740\u6bb5&#xff1a;\u5171\u4eab\u578b ELB \u7528 100.125.0.0\/16 \u505a\u5065\u5eb7\u68c0\u67e5&#xff0c;\u540e\u7aef\u5b89\u5168\u7ec4\u5fc5\u987b\u653e\u901a\u8fd9\u4e2a\u7f51\u6bb5&#xff0c;\u5426\u5219\u6c38\u8fdc\u4e0d\u5065\u5eb7\u3002<\/p>\n<p>\u4e09\u5bb6\u5728\u8fd9\u4e2a\u95ee\u9898\u4e0a\u7684\u7ed3\u8bba\u9ad8\u5ea6\u4e00\u81f4&#xff1a;\u5065\u5eb7\u68c0\u67e5\u5931\u8d25\u662f LB \u5c42 502 \u7684\u7b2c\u4e00\u5927\u6210\u56e0&#xff0c;\u800c\u5065\u5eb7\u68c0\u67e5\u5931\u8d25\u7684\u7b2c\u4e00\u5927\u6210\u56e0&#xff0c;\u662f LB \u7684\u63a2\u6d4b\u6e90\u5730\u5740\u88ab\u540e\u7aef\u7684\u67d0\u4e2a\u9632\u706b\u5899\u62e6\u4e86\u3002<\/p>\n<p>2&#xff09;\u8bc1\u4e66\u8fc7\u671f\u3002 \u6d4f\u89c8\u5668\u62a5 ERR_CERT_DATE_INVALID&#xff0c;\u8868\u73b0\u4e3a\u7ea2\u8272\u8b66\u544a\u9875&#xff0c;\u800c\u4e0d\u662f 502\u3002\u67e5\u6cd5&#xff1a;<\/p>\n<p>openssl x509 <span class=\"token parameter variable\">-in<\/span> \/path\/to\/cert.pem <span class=\"token parameter variable\">-noout<\/span> <span class=\"token parameter variable\">-subject<\/span> <span class=\"token parameter variable\">-dates<\/span><\/p>\n<p>\u6211\u8fd9\u5728\u672c\u673a\u62ff\u4e00\u5f20\u81ea\u7b7e\u8bc1\u4e66\u8dd1\u7684\u771f\u5b9e\u8f93\u51fa&#xff1a;<\/p>\n<p>subject&#061;CN&#061;demo.example.com<br \/>\nnotBefore&#061;Oct 12 02:03:42 2026 GMT<br \/>\nnotAfter&#061;Nov 11 02:03:42 2026 GMT<\/p>\n<p>**\u53ea\u770b\u8fc7\u671f\u65f6\u95f4\u5c31\u7528 -enddate\u3002**\u53e6\u5916\u522b\u5fd8\u4e86&#xff1a;\u8bc1\u4e66\u8fd8\u5728\u6709\u6548\u671f\u5185\u4e5f\u7167\u6837\u62a5\u9519\u2014\u2014\u5982\u679c\u670d\u52a1\u5668\u7cfb\u7edf\u65f6\u95f4\u9519\u4e86\u3002\u65f6\u95f4\u4e0d\u51c6\u4f1a\u8ba9\u6240\u6709 HTTPS \u7ad9\u70b9\u5728\u540c\u4e00\u65f6\u523b\u96c6\u4f53\u5931\u6548&#xff0c;\u4e14\u62a5\u9519\u4e94\u82b1\u516b\u95e8\u3002<\/p>\n<p>3&#xff09;\u95f4\u6b47\u6027\u7684\u90a3\u4e00\u7c7b\u3002 \u65f6\u4e0d\u65f6\u51fa\u73b0\u3001\u5237\u65b0\u53c8\u597d\u2014\u2014\u9664\u4e86\u7b2c\u56db\u8282\u7684 fail_timeout&#xff0c;\u901a\u5e38\u8fd8\u5269\u8fd9\u4e09\u4e2a&#xff1a;\u540e\u7aef\u8fde\u63a5\u6c60\u8017\u5c3d\u3001PHP-FPM \u7684 pm.max_children \u6253\u6ee1\u3001listen \u7684 backlog \u6ea2\u51fa\u3002\u8fd9\u4e00\u7c7b\u8981\u770b\u540e\u7aef\u81ea\u5df1\u7684\u72b6\u6001&#xff0c;\u4e0d\u662f nginx \u7684\u3002<\/p>\n<hr \/>\n<h3>\u516b\u3001\u4ec0\u4e48\u65f6\u5019\u4e0d\u8be5\u67e5\u8fd9\u4e00\u5957&#xff1a;\u4e09\u6761\u8fb9\u754c<\/h3>\n<p>\u8bf4\u6e05\u695a\u8fb9\u754c&#xff0c;\u7701\u5f97\u7528\u9519\u529b\u6c14&#xff1a;<\/p>\n<p>\u573a\u666f\u4e00&#xff1a;\u9759\u6001\u9875\u6b63\u5e38&#xff0c;\u52a8\u6001\u63a5\u53e3\u624d\u62a5\u9519\u3002 \u90a3\u95ee\u9898\u57fa\u672c\u9501\u5b9a\u5728\u540e\u7aef\u8fdb\u7a0b&#xff0c;nginx \u53ea\u662f\u4f20\u8bdd\u7684\u3002\u522b\u5728 nginx \u914d\u7f6e\u4e0a\u6298\u817e\u3002<\/p>\n<p>\u573a\u666f\u4e8c&#xff1a;\u53ea\u6709\u90e8\u5206\u5730\u533a\u6216\u4e2a\u522b\u7528\u6237\u62a5\u9519\u3002 \u8fd9\u662f\u94fe\u8def\u6216 DNS \u7684\u4e8b&#xff0c;\u4e0d\u662f nginx \u5230\u540e\u7aef\u8fd9\u4e00\u6bb5\u3002\u4e09\u4e2a\u5730\u533a\u7684\u7528\u6237\u540c\u65f6\u62a5\u624d\u662f\u670d\u52a1\u7aef\u95ee\u9898\u3002<\/p>\n<p>\u573a\u666f\u4e09&#xff1a;\u9519\u8bef\u53ea\u5728\u4e1a\u52a1\u9ad8\u5cf0\u671f\u51fa\u73b0\u3002 \u8fd9\u662f\u5bb9\u91cf\u95ee\u9898\u2014\u2014fail_timeout\u3001\u8d85\u65f6\u65f6\u95f4\u8c03\u518d\u5927\u4e5f\u53ea\u662f\u628a\u9519\u8bef\u63a8\u540e&#xff0c;\u4e0d\u4f1a\u8ba9\u5b83\u6d88\u5931\u3002\u8be5\u6269\u5bb9\u6269\u5bb9&#xff0c;\u8be5\u52a0\u7f13\u5b58\u52a0\u7f13\u5b58\u3002<\/p>\n<hr \/>\n<h3>\u4e5d\u3001\u6ca1\u6709\u65e5\u5fd7\u6743\u9650\u65f6&#xff1a;\u7528 curl \u81ea\u5df1\u628a\u8fd9\u4e09\u4e2a\u6570\u6d4b\u51fa\u6765<\/h3>\n<p>\u8fd9\u4e00\u8282\u662f\u6211\u89c9\u5f97\u6700\u5b9e\u7528\u7684\u4e00\u62db&#xff0c;\u5c24\u5176\u662f\u673a\u5668\u4e0d\u5728\u4f60\u624b\u4e0a\u3001\u6216\u8005\u4f60\u53ea\u6709\u8bbf\u95ee\u6743\u9650\u7684\u65f6\u5019\u3002<\/p>\n<p>curl \u7684 -w \u53ef\u4ee5\u628a\u4e00\u6b21\u8bf7\u6c42\u62c6\u6210\u51e0\u6bb5\u5206\u522b\u8ba1\u65f6&#xff08;\u6587\u6863\u89c1 curl \u5b98\u65b9\u300aWrite out\u300b&#xff09;&#xff1a;<\/p>\n<p><span class=\"token function\">curl<\/span> <span class=\"token parameter variable\">-o<\/span> \/dev\/null <span class=\"token parameter variable\">-sS<\/span> <span class=\"token parameter variable\">-w<\/span> <span class=\"token string\">&#039;dns&#061;%{time_namelookup} connect&#061;%{time_connect} firstbyte&#061;%{time_starttransfer} total&#061;%{time_total}\\\\n&#039;<\/span> <span class=\"token punctuation\">\\\\<\/span><br \/>\n  https:\/\/demo.example.com\/api\/order<\/p>\n<p>\u6211\u672c\u673a\u8dd1\u7684\u4e24\u4e2a\u5bf9\u7167\u7ed3\u679c&#xff08;\u4e00\u4e2a\u662f\u6b63\u5e38\u7684&#xff0c;\u4e00\u4e2a\u662f sleep 3 \u79d2\u7684\u6162\u63a5\u53e3&#xff09;&#xff1a;<\/p>\n<p>http&#061;200  dns&#061;0.000042s  connect&#061;0.000925s  starttransfer(\u9996\u5b57\u8282)&#061;0.001808s  total&#061;0.001996s<br \/>\nhttp&#061;200  dns&#061;0.000060s  connect&#061;0.001267s  starttransfer(\u9996\u5b57\u8282)&#061;3.002423s  total&#061;3.002719s<\/p>\n<p>\u770b\u7b2c\u4e8c\u884c&#xff1a;connect \u51e0\u4e4e\u4e0d\u8017\u65f6&#xff0c;time_starttransfer \u5374\u6574\u6574 3 \u79d2\u3002 \u8fd9\u5c31\u662f\u540e\u7aef\u7684\u5904\u7406\u65f6\u95f4\u2014\u2014\u5b83\u7ed9\u51fa\u7684\u6b63\u662f nginx \u7684 upstream_response_time \u90a3\u4e00\u4e2a\u91cf\u3002<\/p>\n<p>\u800c\u8fde\u63a5\u5931\u8d25\u65f6&#xff0c;http_code \u4f1a\u662f 000&#xff08;\u8868\u793a\u538b\u6839\u6ca1\u62ff\u5230\u54cd\u5e94&#xff09;&#xff1a;<\/p>\n<p>curl: (7) Failed to connect to 127.0.0.1 port 59999 after 2038 ms: Could not connect to server<\/p>\n<p>\u4e8e\u662f\u4e0d\u9700\u8981\u4efb\u4f55\u65e5\u5fd7\u6743\u9650&#xff0c;\u4f60\u4e5f\u80fd\u628a\u5931\u8d25\u5206\u6210\u4e24\u7c7b&#xff1a;<\/p>\n<ul>\n<li>firstbyte \u63a5\u8fd1 0&#xff0c;\u4e14\u72b6\u6001\u7801\u4e3a 000 \u6216\u7acb\u523b\u5931\u8d25 \u2192 \u8fde\u63a5\u88ab\u62d2\u7edd&#xff0c;\u5bf9\u5e94\u7b2c\u4e09\u8282<\/li>\n<li>connect \u5f88\u5feb\u3001firstbyte \u5f88\u957f \u2192 \u540e\u7aef\u5904\u7406\u6162&#xff0c;\u5bf9\u5e94\u7b2c\u4e94\u8282<\/li>\n<\/ul>\n<p>\u963f\u91cc\u4e91\u90a3\u4efd\u6587\u6863\u91cc\u5224\u65ad 502 \u6765\u6e90\u7684\u65b9\u6cd5\u4e5f\u662f\u8fd9\u4e2a\u903b\u8f91&#xff1a;upstream_response_time \u63a5\u8fd1 0 \u8bf4\u660e\u8fde\u63a5\u88ab\u62d2&#xff0c;\u63a5\u8fd1\u8d85\u65f6\u9608\u503c\u8bf4\u660e\u8d85\u65f6\u3002 \u4e24\u79cd\u65b9\u6cd5\u6d4b\u7684\u662f\u540c\u4e00\u4e2a\u91cf&#xff0c;\u4e00\u4e2a\u5728 LB \u89c6\u89d2&#xff0c;\u4e00\u4e2a\u5728\u5ba2\u6237\u7aef\u89c6\u89d2\u3002<\/p>\n<hr \/>\n<h3>\u5341\u3001\u987a\u5e8f\u603b\u7ed3<\/h3>\n<p>\u6392\u5230\u8fd9\u91cc&#xff0c;\u6211\u53ef\u4ee5\u7ed9\u4e00\u4e2a\u80fd\u4ece\u5934\u8d70\u5230\u5c3e\u7684\u987a\u5e8f\u4e86\u3002\u7f51\u7edc\u8fde\u63a5\u5f02\u5e38\u7f51\u7ad9\u670d\u52a1\u5668\u5931\u53bb\u54cd\u5e94 \u8fd9\u7c7b\u6a21\u7cca\u53cd\u9988\u8fdb\u6765\u65f6&#xff0c;\u6211\u6309\u8fd9\u4e2a\u8d70&#xff1a;<\/p>\n<li>\u786e\u8ba4\u662f\u4e0d\u662f HTTP \u5c42&#xff1a;\u62ff\u5f97\u5230 5xx \u6570\u5b57\u624d\u8fdb\u672c\u6587\u8303\u56f4&#xff1b;\u62ff\u4e0d\u5230&#xff08;\u8d85\u65f6\/\u65e0\u6cd5\u8bbf\u95ee&#xff09;\u5148\u53bb\u67e5\u94fe\u8def<\/li>\n<li>\u7ffb error_log&#xff0c;\u6284\u4e0b\u90a3\u4e00\u884c\u82f1\u6587\u539f\u6587\u2014\u2014\u4e0d\u662f\u770b\u72b6\u6001\u7801&#xff0c;\u662f\u770b\u4e2d\u95f4\u90a3\u53e5<\/li>\n<li>connect() failed (111) \u2192 \u672c\u673a curl \u76f4\u8fde\u540e\u7aef&#xff0c;\u67e5\u8fdb\u7a0b\u3001\u67e5\u7aef\u53e3\u3001\u67e5 socket \u6587\u4ef6<\/li>\n<li>Permission denied (13) \u2192 \u5bf9\u8d26 nginx \u7528\u6237\u4e0e socket \u5c5e\u4e3b&#xff0c;\u6574\u6761\u8def\u5f84\u90fd\u8981\u80fd\u8d70<\/li>\n<li>no live upstreams \u2192 \u540e\u7aef\u662f\u597d\u7684&#xff0c;\u67e5 max_fails \/ fail_timeout&#xff0c;\u8c03\u5927\u5e76\u52a0 keepalive<\/li>\n<li>upstream timed out (110) \u2192 \u540e\u7aef\u6162\u3002\u8981\u4e48\u8ba9\u540e\u7aef\u5feb&#xff0c;\u8981\u4e48\u8c03 proxy_read_timeout&#xff08;\u9ed8\u8ba4 60s&#xff09;<\/li>\n<li>prematurely closed \/ reset by peer \u2192 \u540e\u7aef\u5d29\u4e86&#xff0c;\u53bb\u7ffb\u540e\u7aef\u65e5\u5fd7\u548c dmesg<\/li>\n<li>error_log \u91cc\u4ec0\u4e48\u90fd\u6ca1\u6709 \u2192 \u6362\u65b9\u5411&#xff1a;LB \u5065\u5eb7\u68c0\u67e5 &#043; \u63a2\u6d4b\u6e90\u7f51\u6bb5\u3001\u8bc1\u4e66\u6709\u6548\u671f\u4e0e\u7cfb\u7edf\u65f6\u95f4\u3001\u540e\u7aef\u8fde\u63a5\u6c60<\/li>\n<li>\u6ca1\u6709\u65e5\u5fd7\u6743\u9650 \u2192 curl -w \u6d4b time_connect \u4e0e time_starttransfer&#xff0c;\u81ea\u5df1\u628a\u5931\u8d25\u5f52\u7c7b<\/li>\n<p>\u6700\u540e\u8865\u4e00\u53e5\u6211\u7684\u4e2a\u4eba\u770b\u6cd5&#xff1a;\u522b\u628a proxy_read_timeout \u5f80\u4e0a\u8c03\u5f53\u6210\u89e3\u51b3\u95ee\u9898\u7684\u624b\u6bb5\u3002 60 \u79d2\u7684\u9ed8\u8ba4\u503c\u7684\u610f\u601d\u662f&#034;\u7528\u6237\u4e0d\u53ef\u80fd\u7b49\u8fd9\u4e48\u4e45&#034;\u2014\u2014\u628a\u8fd9\u4e2a\u5c3a\u5b50\u8c03\u5230 300 \u79d2&#xff0c;\u4f60\u5f97\u5230\u7684\u4e0d\u662f\u4fee\u597d\u4e86&#xff0c;\u800c\u662f\u7528\u6237\u770b\u5230\u4e00\u4e2a\u6c38\u8fdc\u5728\u8f6c\u5708\u7684\u7a7a\u767d\u9875&#xff0c;\u5916\u52a0\u4e00\u5806\u6302\u6b7b\u7684\u8fde\u63a5\u5360\u7740\u540e\u7aef\u3002\u771f\u6b63\u8be5\u505a\u7684\u662f\u8ba9\u540e\u7aef\u5728 1 \u79d2\u5185\u7b54\u5b8c&#xff0c;\u6216\u8005\u628a\u8fd9\u4e2a\u63a5\u53e3\u6539\u6210\u5f02\u6b65\u3002<\/p>\n<p>\u56de\u5230\u5f00\u5934\u90a3\u53e5&#xff1a;\u8fd9\u4e9b error_log \u91cc\u7684\u82f1\u6587\u770b\u7740\u5413\u4eba&#xff0c;\u4f46\u5b83\u4eec\u662f nginx \u7ed9\u51fa\u7684\u5b8c\u6574\u7b54\u6848&#xff0c;\u4e0d\u662f\u4e00\u4e2a\u5f85\u7834\u8bd1\u7684\u5bc6\u7801\u3002\u6284\u4e0b\u6765\u3001\u5bf9\u4e0a\u8868&#xff0c;\u5269\u4e0b\u7684\u90fd\u662f\u673a\u68b0\u52a8\u4f5c\u3002<\/p>\n<p>\u6211\u5199\u8fd9\u7bc7\u7684\u8d77\u56e0\u5c31\u662f\u90a3\u53f0\u88ab\u91cd\u542f\u8fc7\u4e24\u6b21\u7684\u673a\u5668\u2014\u2014\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e \u7684\u7b54\u6848\u4ece\u6765\u4e0d\u5728\u63a7\u5236\u9762\u677f\u7684\u91cd\u542f\u6309\u94ae\u4e0a&#xff0c;\u800c\u5728\u90a3\u4e00\u884c\u88ab\u5ffd\u7565\u7684\u65e5\u5fd7\u91cc\u3002\u5148\u8bfb\u65e5\u5fd7&#xff0c;\u518d\u52a8\u624b&#xff0c;\u8fd9\u4e00\u6761\u6bd4\u672c\u6587\u6240\u6709\u7684\u547d\u4ee4\u90fd\u503c\u94b1\u3002<\/p>\n<hr \/>\n<h3>FAQ<\/h3>\n<p>\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u662f\u4ec0\u4e48\u539f\u56e0\u5bfc\u81f4\u7684&#xff1f;<\/p>\n<p>\u7edd\u5927\u591a\u6570\u662f nginx \u4e4b\u540e\u7684\u540e\u7aef\u8fdb\u7a0b\u51fa\u4e86\u95ee\u9898&#xff1a;\u8fdb\u7a0b\u5d29\u4e86\u3001\u7aef\u53e3\u4e0d\u5bf9\u3001\u5904\u7406\u592a\u6162\u3001\u6216\u8005 socket \u6743\u9650\u4e0d\u8db3\u3002nginx \u81ea\u5df1\u51fa\u95ee\u9898\u53cd\u800c\u5f88\u5c11\u89c1\u2014\u2014\u5b83\u51fa\u9519\u65f6\u901a\u5e38\u662f\u542f\u52a8\u5931\u8d25\u3001\u76f4\u63a5\u8fde\u4e0d\u4e0a&#xff0c;\u800c\u4e0d\u662f\u8fd4\u56de 502\u3002<\/p>\n<p>\u600e\u4e48\u533a\u5206 502 \u548c 504&#xff1f;<\/p>\n<p>502 \u662f\u8fde\u63a5\u5c42\u9762\u6ca1\u8c08\u6210&#xff08;\u540e\u7aef\u6ca1\u542c\u8bb2 connect refused&#xff09;&#xff0c;504 \u662f\u8fde\u4e0a\u4e86\u4f46\u540e\u7aef\u6ca1\u5728 proxy_read_timeout&#xff08;\u9ed8\u8ba4 60 \u79d2&#xff09;\u5185\u628a\u8bdd\u8bf4\u5b8c\u3002\u5b83\u4eec\u5206\u5c45\u7b2c\u4e09\u8282\u548c\u7b2c\u4e94\u8282&#xff0c;\u5904\u7406\u601d\u8def\u5b8c\u5168\u4e0d\u642d\u754c\u3002<\/p>\n<p>\u4e3a\u4ec0\u4e48\u91cd\u542f\u670d\u52a1\u5668\u4e4b\u540e\u5c31\u597d\u4e86&#xff0c;\u8fc7\u4e00\u4f1a\u513f\u53c8\u4e0d\u884c&#xff1f;<\/p>\n<p>\u5178\u578b\u7684\u8d44\u6e90\u8017\u5c3d\u578b&#xff1a;\u8fdb\u7a0b\u8d77\u6765\u540e\u6491\u4e00\u6bb5\u65f6\u95f4\u53c8\u88ab OOM \u6740\u6389&#xff0c;\u6216\u8fde\u63a5\u6c60\u88ab\u6162\u6162\u5360\u6ee1\u3002\u4f60\u53bb\u67e5\u7684\u65f6\u5019\u5b83\u521a\u597d\u6d3b\u5f97\u597d\u597d\u7684&#xff0c;\u6240\u4ee5\u770b\u8d77\u6765&#034;\u597d\u4e86&#034;\u3002\u8fd9\u79cd\u60c5\u51b5\u5e94\u8be5\u53bb\u770b dmesg \u91cc\u7684 OOM \u8bb0\u5f55&#xff0c;\u800c\u4e0d\u662f\u7ee7\u7eed\u91cd\u542f\u3002<\/p>\n<p>\u5237\u65b0\u4e00\u4e0b\u5c31\u597d\u4e86&#xff0c;\u662f\u4e0d\u662f\u53ef\u4ee5\u5ffd\u7565&#xff1f;<\/p>\n<p>\u4e0d\u80fd&#xff0c;\u8fd9\u6070\u6070\u662f\u7b2c\u56db\u8282\u7684\u5178\u578b\u75c7\u72b6\u3002max_fails \u9ed8\u8ba4\u4e3a 1&#xff0c;\u4e00\u6b21\u6296\u52a8\u5c31\u6458 10 \u79d2\u2014\u2014\u5237\u65b0\u4e00\u6b21\u6b63\u597d\u8fc7\u4e86\u8fd9 10 \u79d2\u3002\u771f\u6b63\u7684\u4fee\u6cd5\u662f\u8c03 fail_timeout \u5e76\u52a0 keepalive&#xff0c;\u800c\u4e0d\u662f\u8ba9\u7528\u6237\u9760\u5237\u65b0\u81ea\u6551\u3002<\/p>\n<p>\u53ea\u6709 HTTPS \u6253\u4e0d\u5f00&#xff0c;HTTP \u80fd\u6253\u5f00&#xff0c;\u662f\u54ea\u91cc\u7684\u95ee\u9898&#xff1f;<\/p>\n<p>\u8d70\u7b2c\u4e03\u8282\u7684\u8bc1\u4e66\u4e0e\u65f6\u95f4\u90a3\u90e8\u5206\u3002\u7528 openssl x509 -noout -enddate \u786e\u8ba4\u8bc1\u4e66\u6709\u6548\u671f&#xff0c;\u518d\u7528 date \u548c\u7cfb\u7edf\u65e5\u5fd7\u786e\u8ba4\u670d\u52a1\u5668\u65f6\u95f4\u6709\u6ca1\u6709\u6f02\u79fb\u2014\u2014\u8bc1\u4e66\u6709\u6548\u4f46\u7cfb\u7edf\u65f6\u95f4\u9519\u4e86&#xff0c;\u7ed3\u679c\u4e0e\u8bc1\u4e66\u8fc7\u671f\u5b8c\u5168\u4e00\u6837\u3002<\/p>\n<p>\u5df2\u7ecf\u5230\u670d\u52a1\u5668\u4e0a\u3001\u65f6\u95f4\u53c8\u5f88\u7d27&#xff0c;\u7b2c\u4e00\u6b65\u505a\u4ec0\u4e48&#xff1f;<\/p>\n<p>\u5148\u8dd1 tail -50 \/var\/log\/nginx\/error.log&#xff0c;\u770b\u6700\u540e\u90a3\u4e00\u884c\u82f1\u6587\u3002\u76f8\u6bd4\u4e4b\u4e0b&#xff0c;\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e \u8fd9\u7c7b\u5173\u952e\u8bcd\u641c\u51fa\u6765\u7684\u901a\u7528\u7b54\u6848&#xff0c;\u5927\u591a\u4f1a\u8ba9\u4f60\u91cd\u542f\u2014\u2014\u800c\u91cd\u542f\u6070\u6070\u4f1a\u62b9\u6389\u73b0\u573a\u3002\u770b\u5b8c\u65e5\u5fd7\u518d\u51b3\u5b9a\u8981\u4e0d\u8981\u91cd\u542f\u3002<\/p>\n<p>\u7f51\u7ad9\u670d\u52a1\u5668\u4e0d\u7a33\u5b9a\u600e\u4e48\u6253\u5f00\u7f51\u9875&#xff1f;<\/p>\n<p>\u5148\u5206\u6e05\u662f\u4e0d\u7a33\u5b9a&#xff08;\u95f4\u6b47\u6210\u529f&#xff09;\u8fd8\u662f\u5f7b\u5e95\u6253\u4e0d\u5f00\u3002\u95f4\u6b47\u6210\u529f\u4f18\u5148\u6000\u7591 LB \u5065\u5eb7\u68c0\u67e5\u6296\u52a8\u3001fail_timeout \u6458\u9664\u3001\u4ee5\u53ca\u540e\u7aef\u8fde\u63a5\u6c60\u8017\u5c3d&#xff1b;\u5f7b\u5e95\u6253\u4e0d\u5f00\u624d\u6309\u4e0a\u9762\u7684\u4e5d\u6b65\u4ece\u94fe\u8def\u67e5\u8d77\u3002\u8fd9\u4e24\u8005\u7684\u6392\u67e5\u8def\u5f84\u5dee\u522b\u5f88\u5927&#xff0c;\u522b\u6df7\u7740\u6765\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content<\/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,43,44],"topic":[],"class_list":["post-116641","post","type-post","status-publish","format-standard","hentry","category-server","tag-nginx","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c - \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\/116641.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/116641.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-21T15:49:13+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\/116641.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/116641.html\",\"name\":\"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-21T15:49:13+00:00\",\"dateModified\":\"2026-10-21T15:49:13+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/116641.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/116641.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/116641.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c\"}]},{\"@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":"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c - \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\/116641.html","og_locale":"zh_CN","og_type":"article","og_title":"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\/* MD \/ \u5bcc\u6587\u672c\u4e2d\u7684 .toc\uff08\u542b\u535a\u5ba2\u56ed\u642c\u5bb6\u7b49\u5d4c\u5957\u7ed3\u6784\uff09\uff1b.toc-box \u5728\u4fa7\u680f\uff0c\u4e0d\u53d7\u5f71\u54cd *\/#content_views .toc,\/* \u7f16\u8f91\u5668\u5e38\u5728\u76ee\u5f55\u524d\u540e\u63d2\u5165\u7a7a p\uff08:empty \u4ecd\u5360 20px\uff09\uff0c\u4e00\u5e76\u53bb\u6389\u907f\u514d\u9876\u7a7a\u9699 *\/#content_views.markdown_views &gt; p:empty:has(+ .toc),#content_views.markdown_views &gt; .toc + p:empty,\/* \u5bcc\u6587\u672c\u65e7\u7248\u76ee\u5f55\u6807\u8bb0 *\/#content","og_url":"https:\/\/www.wsisp.com\/helps\/116641.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-21T15:49:13+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\/116641.html","url":"https:\/\/www.wsisp.com\/helps\/116641.html","name":"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-21T15:49:13+00:00","dateModified":"2026-10-21T15:49:13+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/116641.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/116641.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/116641.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u7f51\u7ad9\u670d\u52a1\u5668\u5f02\u5e38\u600e\u4e48\u529e\uff1f\u4e94\u4e2a 5xx \u5728\u6d4f\u89c8\u5668\u91cc\u957f\u5f97\u4e00\u6837\uff0c\u533a\u522b\u53ea\u5728 nginx \u90a3\u4e00\u65e5\u5fd7\u884c"}]},{"@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\/116641","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=116641"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/116641\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=116641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=116641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=116641"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=116641"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}