5

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 while reading response header from upstream, client: x.x.x.x, server: blabla.com, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:4000", host: "x.x.x.x"

I appreciate your hints to resolve this.

alfish
  • 3,027
  • 15
  • 45
  • 68
  • 1
    I was wondering if you ever solved this problem. The same thing is happening to me now and its really frustrating. – thebeagle Jul 15 '11 at 06:36
  • 2
    @TheBeagle This happens due to the upstream script crashing before it can properly close the connection. Most likely it's a bad module that causes a segmentation fault or some form of crash. – Martin Fjordvald Jul 15 '11 at 07:15

1 Answers1

3

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 /var/log/uwsgi.

Antonis Christofides
  • 2,556
  • 2
  • 22
  • 35