title: Django + uwsgi + nginx + CentOS 7 : connection refused on 8001 port
body: <p>Django + uwsgi + nginx + CentOS 7 : connection refused on 8001 port</p>
  
  <p>I get http 520 error when I tried to go to <a href="http://domain.com:8000" rel="nofollow">http://domain.com:8000</a></p>
  
  <p><strong>nginx.conf</strong></p>
  
  <pre><code>    upstream django {
          # connect to this socket
          # server unix:///tmp/uwsgi.sock;    # for a file socket
          server 127.0.0.1:8001;      # for a web port socket
  
          }
  
      server {
          # the port your site will be served on
          listen      8000;
          # the domain name it will serve for
          server_name domain.com;   # substitute your machine's IP address or FQDN
          #root /home/mysite;
          charset     utf-8;
  
          #Max upload size
          client_max_body_size 75M;   # adjust to taste
  
  
          # Finally, send all non-media requests to the Django server.
          location / {
              uwsgi_pass  django;
              include     /home/mysite/uwsgi_params; # or the uwsgi_params you installed manually
              }
  
  
          }
  </code></pre>
  
  <p>error message on /var/log/nginx/error.log</p>
  
  <pre><code>2015/04/09 12:28:07 [error] 23235#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 118.131.206.235, server: domain.com, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "domain.com:8000"
  2015/04/09 12:28:08 [error] 23235#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 118.131.206.235, server: domain.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "domain.com:8000"
  </code></pre>
  
  <p>I've tried everything but couldn't find any clue that it gives me http 502 error.</p>