{"id":3849,"date":"2019-02-12T15:55:28","date_gmt":"2019-02-12T07:55:28","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3849"},"modified":"2019-02-12T15:55:28","modified_gmt":"2019-02-12T07:55:28","slug":"nginx-tomcat-%e6%8a%a5-504-gateway-time-out-%e9%94%99%e8%af%af%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3849","title":{"rendered":"Nginx + Tomcat \u62a5 504 Gateway Time-out \u9519\u8bef\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\n\t\u6211\u8bb0\u5f97\u524d\u9762\u6709\u7bc7\u6587\u7ae0\u300a<a href=\"https:\/\/www.xttblog.com\/?p=3793\">RestTemplate postForEntity 400 bad request \u95ee\u9898\u89e3\u51b3\u65b9\u6cd5<\/a>\u300b\u4e2d\uff0c\u6211\u5df2\u7ecf\u8bf4\u8fc7\u4e86\u53ea\u8981\u662f 5xx \u9519\u8bef\uff0c\u90a3\u4e00\u5b9a\u662f\u670d\u52a1\u7aef\u7684\u95ee\u9898\u3002\n<\/p>\n<p>\n\t\u6700\u8fd1\u6211\u4eec\u7684\u62a5\u8868\u7cfb\u7edf\u53c8\u51fa\u4e86\u70b9\u95ee\u9898\u3002\u8fd0\u8425\u5728\u540e\u53f0\u5bfc\u51fa\u90e8\u5206\u8ba2\u5355\u65f6\uff0c\u51fa\u73b0\u4e86&nbsp;504 Gateway Time-out \u9519\u8bef\u3002\u4e8e\u662f\u7d27\u6025\u7535\u8bdd\u8054\u7cfb\u4e86\u6211\uff0c\u6211\u8ba9\u540c\u4e8b\u6392\u67e5\u4e86\u4e00\u4e0b\uff01\u6700\u540e\u89e3\u51b3\u4e86\u5b83\uff01\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"Nginx 504 Gateway Time-out \u95ee\u9898\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g03ofw5qzwj20et08vwem.jpg\" style=\"width: 533px;height: 319px\" \/>\n<\/p>\n<p>\n\t\u540c\u4e8b\u770b\u5230\u8fd9\u4e2a\u95ee\u9898\u61f5\u4e86\uff0c\u8bf4 504 \u662f\u7f51\u7edc\u95ee\u9898\uff0c\u4e0e\u670d\u52a1\u7aef\u65e0\u5173\u3002\u90a3\u6211\u5c31\u5728\u8fd9\u91cc\u518d\u6b21\u5f3a\u8c03\u4e00\u4e0b\uff0c5xx \u9519\u8bef\uff0c5xx \u72b6\u6001\u7801\u4e00\u5b9a\u662f\u670d\u52a1\u5668\u7684\u95ee\u9898\u30024xx \u72b6\u6001\u7801\u4e00\u5b9a\u662f\u8bf7\u6c42\u8d44\u6e90\u8def\u5f84\u95ee\u9898\u3002\u5176\u4ed6\u7684\u5e38\u89c1\u9519\u8bef\u7801\u4f60\u770b\u6211\u4e0a\u9762\u7684\u90a3\u7bc7\u6587\u7ae0\u5c31\u884c\u4e86\u3002\n<\/p>\n<p>\n\t\u90a3\u4e48\u8fd9\u4e2a 504 \u7684\u9519\u8bef\u662f\u600e\u4e48\u4ea7\u751f\u7684\u5462\uff1f\u7b54\u6848\u662f\uff0c\u4f60\u4f7f\u7528 nginx \u7684\u4ee3\u7406\u300a<a href=\"https:\/\/www.xttblog.com\/?p=3847\">Nginx \u4e2d\u7684\u53cd\u5411\u4ee3\u7406 proxy_pass \u914d\u7f6e\u6559\u7a0b<\/a>\u300b\uff0cTomcat \u6ca1\u6709\u8d85\u65f6\uff0c\u800c\u4f60\u7684 Nginx \u8d85\u65f6\u4e86\u3002\u7531\u4e8e\u4f60\u4f7f\u7528 Nginx \u7684\u53cd\u5411\u4ee3\u7406\u529f\u80fd\uff0c\u6240\u4ee5\uff0c\u8fd9\u4e2a\u65f6\u5019 Nginx \u5c31\u662f\u76f8\u5f53\u4e8e\u4e00\u4e2a\u7f51\u5173&nbsp;Gateway\u3002\n<\/p>\n<p>\n\t\u90a3\u4e48\u600e\u4e48\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u5462\uff1f\n<\/p>\n<p>\n\t\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u7b2c\u4e00\u79cd\u662f\uff0c\u628a Nginx \u7684\u54cd\u5e94\u8d85\u65f6\u65f6\u95f4\u914d\u7f6e\u7684\u957f\u4e00\u70b9\u3002\n<\/p>\n<p>\n\t\u5728 nginx.conf \u4e2d\uff0c\u8bbe\u7f6e\u4ee5\u4e0b\u51e0\u4e2a\u53c2\u6570\uff0c\u589e\u52a0\u8d85\u65f6\u65f6\u95f4\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nlocation \/xttblog {\r\n    proxy_pass http:\/\/www.xttblog.com:8080\/xttblog;\r\n    proxy_set_header Host $host;\r\n    proxy_set_header X-Real-IP $remote_addr;\r\n    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\r\n    proxy_connect_timeout 300s;\r\n    proxy_send_timeout 300s;\r\n    proxy_read_timeout 300s;\r\n    access_log \/var\/log\/nginx\/access.xttblog.log main;\r\n    error_log \/var\/log\/nginx\/error.xttblog.log;\r\n}<\/pre>\n<p>\n\t\u7b2c\u4e8c\u79cd\u65b9\u6848\u5462\uff0c\u5c31\u662f\u6539\u7a0b\u5e8f\u3002\u5c24\u5176\u662f\u68c0\u67e5\u4f60\u5bfc\u51fa\u62a5\u8868\u7684 SQL \u662f\u4e0d\u662f\u67e5\u8be2\u65f6\u95f4\u8fc7\u957f\uff0c\u5bfc\u51fa\u7684\u6570\u636e\u662f\u4e0d\u662f\u53ef\u4ee5\u5206\u9875\uff0c\u5206\u65f6\u95f4\u6bb5\u6765\u5bfc\u3002\u522b\u4e00\u4e0b\u5b50\u628a\u6240\u6709\u7684\u8ba2\u5355\u90fd\u7ed9\u5bfc\u51fa\u6765\u3002\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"504 gateway timeout\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1g03oxgt71fj208405aq35.jpg\" style=\"width: 292px;height: 190px\" \/>\n<\/p>\n<p>\n\t\u522b\u7ba1\u4e1a\u52a1\u7684\u9700\u6c42\u591a\u4e0d\u5408\u7406\uff0c\u7cfb\u7edf\u6c38\u8fdc\u53ef\u9760\uff0c\u6b63\u5e38\uff0c\u7a33\u5b9a\u624d\u662f\u4f60\u5e94\u8be5\u505a\u5230\u7684\u3002<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3849\">Nginx + Tomcat \u62a5 504 Gateway Time-out \u9519\u8bef\u7684\u89e3\u51b3\u65b9\u6cd5<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6211\u8bb0\u5f97\u524d\u9762\u6709\u7bc7\u6587\u7ae0\u300aRestTemplate postForEntity 400 bad request \u95ee\u9898 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[240,1152,1154,112,242],"class_list":["post-3849","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-log4jtomcat","tag-nginx","tag-tomcat","tag-tomcat-juli-jar"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3849","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3849"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3849\/revisions"}],"predecessor-version":[{"id":3850,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3849\/revisions\/3850"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}