uWSGI nginx error : connect() failed (111: Connection refused) while connecting to upstream
I resolved it by changing the socket configuration in uwsgi.ini
from socket = 127.0.0.1:3031
, to socket = :3031
. I was facing this issue when I ran nginx in one Docker container and uWSGI in another. If you are using command line to start uWSGI then do uwsgi --socket :3031
.
Hope this helps someone stuck with the same issue, during deployment of a Django application using Docker.
FlyingHeem
Updated on June 26, 2022Comments
-
FlyingHeem almost 2 years
I'm experiencing 502 gateway errors when accessing my IP on nginx(http://52.xx.xx.xx/), the logs simply says this:
2015/09/18 13:03:37 [error] 32636#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: xx.xx.xx.xx, server: xx.xx.xx.xx, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8000", host: "xx.xx.xx.xx"
my nginx.conf file
# the upstream component nginx needs to connect to upstream django { # server unix:///path/to/your/mysite/mysite.sock; # for a file socket server 127.0.0.1:8000; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be served on listen 80; # the domain name it will serve for server_name xx.xx.xx.xx; # substitute your machine's IP address or FQDN charset utf-8; access_log /home/ubuntu/test_django/nginx_access.log; error_log /home/ubuntu/test_django/nginx_error.log; # max upload size client_max_body_size 75M; # adjust to taste # Django media location /media { alias /home/ubuntu/test_django/static/media/; # your Django project's media files - amend as required } location /static { alias /home/ubuntu/test_django/static/; # your Django project's static files - amend as required } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /home/ubuntu/test_django/uwsgi_params; # the uwsgi_params file you installed } }
Is there anything wrong with nginx.conf file.....if i use default conf then it is working.
-
itTech about 4 yearswhere do i find the uwsgi.ini file? cant find it. or should i create it, and where i should be?
-
David Maness about 3 years@itTech it won't be called
uwsgi.ini
, it will be called<your_app>.ini
. Read more here: uwsgi-docs.readthedocs.io/en/latest/…