title: 502 error with nginx + uwsgi +django
body: <p>I've tried to configure django on top on nginx and uwsgi and a 502 bad gateway error is encountered when trying to access localhost</p>
  
  <p>This is my /etc/ngingx/sites-available/default file</p>
  
  <pre><code>server {
      server_name testapp1.com www.testapp1.com;
      access_log /var/log/nginx/testapp1.com.access.log;
  
      location / {
          uwsgi_pass unix:///var/run/uwsgi/app/testapp1/socket;
          include uwsgi_params;
      }
  }
  </code></pre>
  
  <p>This is my testapp1.ini file in /etc/nginx/apps-available/</p>
  
  <pre><code>[uwsgi]  
      thread=3  
      master=1  
      env = DJANGO_SETTINGS_MODULE=testapp1.settings  
      module = django.core.handlers.wsgi:WSGIHandler()  
      chdir = /home/paul/apps/testapp1  
      socket = /run/uwsgi/testapp1/socket  
      logto = /var/log/uwsgi/testapp1.log  
  </code></pre>
  
  <p>This is the uwsgi.log file</p>
  
  <blockquote>
    <p>Tue Jul 10 21:49:38 2012 - *** Starting uWSGI 1.0.3-debian (32bit) on<br>
    [Tue Jul 10 21:49:38 2012] *** Tue Jul 10 21:49:38 2012 - compiled<br>
    with version: 4.6.2 on 20 February 2012 10:06:16 Tue Jul 10 21:49:38<br>
    2012 - current working directory: / Tue Jul 10 21:49:38 2012 - writing<br>
    pidfile to /run/uwsgi/app/testapp1/pid Tue Jul 10 21:49:38 2012 -<br>
    detected binary path: /usr/bin/uwsgi-core Tue Jul 10 21:49:38 2012 -<br>
    setgid() to 33 Tue Jul 10 21:49:38 2012 - setuid() to 33 Tue Jul 10<br>
    21:49:38 2012 - your memory page size is 4096 bytes Tue Jul 10<br>
    21:49:38 2012 - uwsgi socket 0 bound to UNIX address<br>
    /run/uwsgi/app/testapp1/socket fd 5 Tue Jul 10 21:49:38 2012 - bind():<br>
    No such file or directory [socket.c line 107]  </p>
  </blockquote>
  
  <p>I didnt change the nginx.conf file.</p>