title: nginx django 502 bad gateway
body: <p>I am using uWSGI and Nginx to server up my Django website (1.4 version).  My file structure is django_mysite/django_mysite/ in which there is a wsgi.py file.<br>
  I keep getting 502 Bad gateway errors.  I have other servers running of nginx and they are working fine.</p>
  
  <p>My nginx config:</p>
  
  <pre><code>server {
    listen      80;
    server_name beta.example.com;
  
    keepalive_timeout 70;
  
    root /path/to/django_mysite/django_mysite;
  
  
    location root {
          root   html;
          uwsgi_pass   localhost:9000;
          uwsgi_param UWSGI_SCRIPT django_wsgi;
          include        uwsgi_params;
      }
  
    location / {
          uwsgi_pass   localhost:9000;
          include        uwsgi_params;
          uwsgi_param SCRIPT_NAME /django;
          uwsgi_param UWSGI_SCRIPT django_wsgi;
          uwsgi_modifier1 30;
      }
  }
  </code></pre>
  
  <p>My wsgi.py file:
      import sys
      import os</p>
  
  <pre><code>sys.path.append('/path/to/django_mysite/')
   os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_mysite.settings")
  
  import django.core.handlers.wsgi
  application = django.core.handlers.wsgi.WSGIHandler()
  </code></pre>
  
  <p>The error in the log is:</p>
  
  <pre><code>*3 recv() failed (104: Connection reset by peer) while reading response header from upstream
  </code></pre>
  
  <p>Thanks</p>