{"id":805,"date":"2012-09-05T16:47:33","date_gmt":"2012-09-05T08:47:33","guid":{"rendered":"http:\/\/www.kumouse.com\/?p=805"},"modified":"2012-09-05T16:47:33","modified_gmt":"2012-09-05T08:47:33","slug":"lnmp-502-bad-gateway-%e9%94%99%e8%af%af%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.kumouse.com\/?p=805","title":{"rendered":"lnmp 502 bad gateway \u9519\u8bef\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u6211\u9760\uff0clnmp\u73af\u5883\uff0c1\u4e2a\u591a\u6708502\u90fd3\u6b21\u4e86\u3002\u7f51\u4e0a\u627e\u4e86\u627e\u89e3\u51b3\u529e\u6cd5\u3002\u5982\u4e0b<\/p>\n<p>&nbsp;<\/p>\n<p>\u89e3\u51b3\u65b9\u6cd5\uff1a<br \/>\n\u53ef\u4ee5\u5c1d\u8bd5\u6839\u636elnmp\u4e00\u952e\u5b89\u88c5\u5305\u4e2d\u7684\u811a\u672c\u624b\u52a8\u5b89\u88c5\u4e00\u4e0b\uff0c\u770b\u770b\u662f\u4ec0\u4e48\u9519\u8bef\u5bfc\u81f4\u7684\uff0c\u5728\u7f51\u4e0a\u641c\u7d22\u4e00\u4e0b\uff0c\u6216\u8005\u628a\u9519\u8bef\u4fe1\u606f\u53d1\u4e0a\u6765\u3002\u5982\u679c\u5b9e\u5728\u4e0d\u4f1a\u63d0\u4f9b\u6309http:\/\/lnmp.org\/install.html\u8fd9\u4e2a\u5b89\u88c5\u65f6\u7684lnmp.log\u65e5\u5fd7\u6587\u4ef6\uff08\u53ef\u4ee5\u7528winscp\u767b\u9646\u4e0b\u8f7dlnmp.log\uff0c\u5e76\u4e0a\u4f20\u5230\u672c\u8bba\u575b\uff09\uff0c\u6ca1\u6709\u9519\u8bef\u4fe1\u606f\u6211\u4eec\u6ca1\u6cd5\u8bf4\u4ec0\u4e48\u539f\u56e0\u3002<\/p>\n<p>\u7b2c\u4e8c\u79cd\u539f\u56e0\uff1a<br \/>\n\u5728php.ini\u91cc\uff0ceaccelerator\u914d\u7f6e\u9879\u4e00\u5b9a\u8981\u653e\u5728Zend Optimizer\u914d\u7f6e\u4e4b\u524d\uff0c\u5426\u5219\u4e5f\u53ef\u80fd\u5f15\u8d77502 Bad Gateway<\/p>\n<p>\u7b2c\u4e09\u79cd\u539f\u56e0\uff1a<br \/>\n\u5728\u5b89\u88c5\u597d\u4f7f\u7528\u8fc7\u7a0b\u4e2d\u51fa\u73b0502\u95ee\u9898\uff0c\u4e00\u822c\u662f\u56e0\u4e3a\u9ed8\u8ba4php-cgi\u8fdb\u7a0b\u662f5\u4e2a\uff0c\u53ef\u80fd\u56e0\u4e3aphpcgi\u8fdb\u7a0b\u4e0d\u591f\u7528\u800c\u9020\u6210502\uff0c\u9700\u8981\u4fee\u6539\/usr\/local\/php\/etc\/php-fpm.conf \u5c06\u5176\u4e2d\u7684max_children\u503c\u9002\u5f53\u589e\u52a0\u3002<br \/>\n\u4e5f\u6709\u53ef\u80fd\u662fmax_requests\u503c\u4e0d\u591f\u7528\u3002<\/p>\n<p>\u7b2c\u56db\u79cd\u539f\u56e0\uff1a<br \/>\nphp\u6267\u884c\u8d85\u65f6\uff0c\u4fee\u6539\/usr\/local\/php\/etc\/php.ini \u5c06max_execution_time \u6539\u4e3a300<\/p>\n<p>\u7b2c\u4e94\u79cd\u539f\u56e0\uff1a<br \/>\n\u78c1\u76d8\u7a7a\u95f4\u4e0d\u8db3\uff0c\u5982mysql\u65e5\u5fd7\u5360\u7528\u5927\u91cf\u7a7a\u95f4<\/p>\n<p>\u7b2c\u516d\u79cd\u539f\u56e0\uff1a<br \/>\n\u67e5\u770bphp-cgi\u8fdb\u7a0b\u662f\u5426\u5728\u8fd0\u884c<\/p>\n<p>\u7b2c\u4e03\u79cd\u539f\u56e0\uff1a<br \/>\n\u5c06nginx.conf\u91cc\u7684<br \/>\nfastcgi_connect_timeout<br \/>\nfastcgi_send_timeout<br \/>\nfastcgi_read_timeout\u90fd\u8c03\u5927\u4e00\u70b9\u3002<\/p>\n<p>\u5176\u4ed6\u53ef\u80fd\u539f\u56e0\uff1ahttp:\/\/bbs.vpser.net\/thread-1654-1-1.html<\/p>\n<p>\u4e5d\u3001\u4e5f\u53ef\u4ee5\u5c1d\u8bd5\u5c06unix\u5957\u63a5\u5b57\u6539\u6210tcp\/ip\u7684\uff0c\u4fee\u6539\/usr\/local\/php\/etc\/php-fpm.cnf \u91cc\u8bbe\u7f6e&lt;value name=\u201clisten_address\u201d&gt;\/tmp\/nginx.socket&lt;\/value&gt; \u6539\u6210&lt;value name=\u201clisten_address\u201d&gt;127.0.0.1:9000&lt;\/value&gt; \uff0c\u540c\u65f6\/usr\/local\/nginx\/conf\/nginx.conf \u53ca\u5176\/usr\/local\/nginx\/conf\/vhost\/ \u4e0b\u9762\u7684\u865a\u62df\u4e3b\u673a\u914d\u7f6e\u91cc\u7684fastcgi_pass\u00a0\u00a0unix:\/tmp\/php-cgi.sock; \u66ff\u6362\u4e3afastcgi_pass\u00a0\u00a0127.0.0.1:9000;\u00a0\u00a0\u4e4b\u540e\u91cd\u542f\u8bd5\u8bd5\u3002<\/p>\n<p>\u5341\u3001\u5982\u679c\u865a\u62df\u4e3b\u673a\u7684\u65e5\u5fd7\u6587\u4ef6\u8fc7\u5927\u4e5f\u53ef\u80fd\u4f1a\u9020\u6210502\u95ee\u9898\u3002<br \/>\n\u5efa\u8bae\u5b9a\u671f\u6e05\u7a7a\u4e00\u4e0b\u865a\u62df\u4e3b\u673a\u7684\u65e5\u5fd7\u6587\u4ef6\u3002<\/p>\n<p>\u8c03\u5927\u4ee5\u4e0b\u4e24\u4e2a\u53c2\u6570(\u9002\u5f53\u8c03\u6574,\u5426\u5219\u5371\u9669.\uff09<\/p>\n<p>&lt;value name=\u201dmax_children\u201d&gt;10&lt;\/value&gt;<br \/>\n&lt;value name=\u201drequest_terminate_timeout\u201d&gt;60s&lt;\/value&gt;<br \/>\nmax_children\u6700\u591a10\u4e2a\u8fdb\u7a0b\uff0c\u6309\u7167\u6bcf\u4e2a\u8fdb\u7a0b20MB\u5185\u5b58\uff0c\u6700\u591a200MB\u3002<br \/>\nrequest_terminate_timeout\u6267\u884c\u7684\u65f6\u95f4\u4e3a60\u79d2\uff0c\u4e5f\u5c31\u662f1\u5206\u949f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u9760\uff0clnmp\u73af\u5883\uff0c1\u4e2a\u591a\u6708502\u90fd3\u6b21\u4e86\u3002\u7f51\u4e0a\u627e\u4e86\u627e\u89e3\u51b3\u529e\u6cd5\u3002\u5982\u4e0b &nbsp; \u89e3\u51b3\u65b9\u6cd5\uff1a \u53ef\u4ee5\u5c1d\u8bd5\u6839\u636el [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-805","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/805","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=805"}],"version-history":[{"count":1,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/805\/revisions"}],"predecessor-version":[{"id":806,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=\/wp\/v2\/posts\/805\/revisions\/806"}],"wp:attachment":[{"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=805"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=805"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kumouse.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}