{"id":1985,"date":"2022-08-30T15:21:05","date_gmt":"2022-08-30T15:21:05","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/08\/nginx-uwsgi-gives-502-bad-gateway-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:21:05","modified_gmt":"2022-08-30T15:21:05","slug":"nginx-uwsgi-gives-502-bad-gateway-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/nginx-uwsgi-gives-502-bad-gateway-collection-of-common-programming-errors\/","title":{"rendered":"nginx+ uwsgi gives 502 Bad Gateway-Collection of common programming errors"},"content":{"rendered":"<p>I used this guide to set it up and it was working to server my django app for a while, but after adding a new django module, without touching any of the nginx or uwsgi configs, now the server leads to 502 502 Bad Gateway error. The nginx error.log says:<\/p>\n<blockquote>\n<p>*1 upstream prematurely closed connection while reading response header from upstream, client: x.x.x.x, server: blabla.com, request: &#8220;GET \/ HTTP\/1.1&#8221;, upstream: &#8220;uwsgi:\/\/127.0.0.1:4000&#8221;, host: &#8220;x.x.x.x&#8221;<\/p>\n<\/blockquote>\n<p>I appreciate your hints to resolve this.<\/p>\n<ol>\n<li>\n<p>This error usually indicates that your Django application has crashed (raised an unhandled exception). You should be able to get more information from the uwsgi logs at <code>\/var\/log\/uwsgi<\/code>.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-08 05:35:56. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>I used this guide to set it up and it was working to server my django app for a while, but after adding a new django module, without touching any of the nginx or uwsgi configs, now the server leads to 502 502 Bad Gateway error. The nginx error.log says: *1 upstream prematurely closed connection [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1985","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1985"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1985\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}