502 error (socket not found) with Nginx, Ubuntu, Uwsgi, Python

I’ve followed this tutorial on how to set up Nginx and Uwsgi on an Ubuntu droplet to have it be internet facing. I’ve done all the necessary setup; running the command uwsgi --socket --protocol=http -w wsgi:app from a terminal works fine. It causes my site to be served on the proper domain name, on port 5000 ( This isn’t ideal, so I’m trying to set it up to A) have it be detached, without me needing to manually run the command, and B) to have it not need port 5000 at the end.

I followed the rest of the tutorial, and have not been able to get it working properly. The source code of the Python application, which works just fine, is here. It’s running off of my branch.


module = wsgi:app

logto = /var/log/uwsgi/%n.log

master = true
processes = 5

socket = myproject.sock
chmod-socket = 660
vacuum = true

die-on-term = true


Description=uWSGI instance to serve myproject

ExecStart=/home/whowouldwin/myproject/myprojectenv/bin/uwsgi --ini myproject.ini



server {
    listen 80;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:///home/whowouldwin/myproject/myproject.sock;

I am trying to proxy my original IP address,, to the domain name When visiting the IP address as-is, I get the following error in /var/log/nginx/error.log. It also shows a 502 Bad Gateway error on the browser.

2018/06/03 01:32:55 [crit] 12288#12288: *7 connect() to unix:///home/whowouldwin/myproject/myproject.sock failed (2: No such file or directory) while connecting to upstream, client: XXXXXX, server:, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///home/whowouldwin/myproject/myproject.sock:", host: ""

I don’t get this error when I access it through It instead shows the generic “Welcome to Ngnix!” page, and no errors, though the views are being logged in /var/log/nginx/access.log.

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

First Header Second Header
Content Cell Content Cell
Content Cell Content Cell run self bot line