I think you've got 2 different uwsgi commands below. One uses the ini file with 
the Unix socket and the other listens on port 8123. It looks like your nginx 
config is looking for the Unix socket so make sure you run uwsgi with the ini 
option so it'll listen on the Unix socket.

On July 16, 2018 12:30:30 AM CDT, need_some_help <useracct...@gmail.com> wrote:
>Having some trouble linking up Django + uWSGI + NGINX
>
>If I run the Django development server, the page works perfectly.
>
>If I run with: uwsgi --http 0.0.0.0:8134 --wsgi-file 
>/test/test_project/wsgi.py and access it at localhost:8134 the site
>works 
>except the images are not being loaded.
>
>But if I access the site at localhost:80 (presumably for nginx
>handling), I 
>get an error in the nginx error.log (the following is for ONE page
>request, 
>so not sure why it looks like two):
>
>2018/07/15 11:55:34 [error] 20986#20986: *1 connect() to 
>unix:/test/test_project/test.sock failed (111: Connection refused)
>while 
>connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request:
>"GET 
>/ HTTP/1.1", upstream: "uwsgi://unix:/test/test_project/test.sock:",
>host: 
>"localhost"
>2018/07/15 11:55:34 [error] 20986#20986: *1 connect() to 
>unix:/test/test_project/test.sock failed (111: Connection refused)
>while 
>connecting to upstream, client: 127.0.0.1, server: 127.0.0.1, request:
>"GET 
>/favicon.ico HTTP/1.1", upstream: 
>"uwsgi://unix:/test/test_project/test.sock:", host: "localhost",
>referrer: 
>"http://localhost/";
>
>I've made sure to run 'sudo service nginx reload' and 'sudo service
>nginx 
>restart'.
>
>
>Primary Question:
>1. Why can I not access the site via localhost:80. I am guessing it has
>to 
>do with the socket file refusing connections; the socket file is empty
>and 
>was created with 'uwsgi --ini test_uwsgi.ini'. Is there something with 
>inetd/xinetd I need to check?
>
>Secondary Questions (may require a separate post):
>1. Not sure if there is something wrong with the configuration or if I
>am 
>running this correctly to begin with at all. Do I have to run 'sudo
>service 
>nginx start' AND run 'uwsgi --http 0.0.0.0:8134 --wsgi-file 
>/test/test_project/wsgi.py'? I'm guessing yes for now unless I somehow 
>automate the uwsgi command through nginx.
>2. Should every script, image and configuration file be owned by
>www-data?
>3. Are my static images folder accessible by uwsgi and nginx (based on
>the 
>configs below)? How to make sure?
>4. I've had issues with cookies not being passed, so if there's
>something 
>with the config preventing that, please let me know.
>
>
>Here is the setup:
>
>/test/test_project/test.sock permissions:
>
>  srwxrwxrwx 1 www-data www-data 0 Jul 14 22:51 test.sock
>  *Obviously I'll want to tighten this up, but for troubleshooting   
>purposes permissions are open wide.
>
>
>/test/test_project/test_uwsgi.ini:
>
>  [uwsgi]
>
>  chdir = /test/test_project
>  module = test.wsgi
>
>  pythonpath = /usr/bin/python2
>  # process-related settings
>  master = true
>  processes = 8
>  socket = /test/test_project/test.sock
>  chmod-socket = 666
>  max-requests = 50000
>
>
>/test/test_project/uwsgi.py:
>
>  def application_backup(environ, start_response):
>      start_response('200 OK', [('Content-Type', 'text/html')])
>      return view.index(environ, start_response)
>
>
>custom_nginx.conf:
>
>  upstream django {
>   server unix:/test/test_project/test.sock;
>   # Also tried unix:///test/test_project/test.sock;
>  }
>
>  server {
>   listen 80;
>   server_name 127.0.0.1;
>   charset utf-8;
>
>  client_max_body_size 1024M;
>
>  location /static {
>   alias /test/test_project/static;
>   }
>
>  location /media {
>   alias /test/test_project/media;
>   }
>
>  location / {
>   uwsgi_pass django;
>   include uwsgi_params;
>   }
>
>   access_log /var/log/nginx/access.log;
>   error_log /var/log/nginx/error.log warn;
>  }
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to django-users+unsubscr...@googlegroups.com.
>To post to this group, send email to django-users@googlegroups.com.
>Visit this group at https://groups.google.com/group/django-users.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/django-users/a8aa34a0-25a9-4361-b388-7db4f0cb8c7e%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/51F87285-C992-49EA-851A-E3FA70CBC875%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to