Report this

What is the reason for this report?

502 nginx error (2: No such file or directory) while connecting to upstream

Posted on September 23, 2016

Hello, I am trying to deploy my flask app and I have followed everything from this tutorial https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-16-04

but when I am on the last step to load my page by the IP address I get a 502

I checked the log and this is what I have connect() to unix:/home/jb/webjosue/my-page/my-page.sock failed (2: No such file or directory) while connecting to upstream

and these are my files

etc/systemd/system/myproject.service

[Unit] Description=Gunicorn instance to serve my-page After=network.target

[Service] User=jb Group=www-data WorkingDirectory=/home/jb/webjosue/my-page Environment=“PATH=/home/jb/webjosue/FlaskENV/bin” ExecStart=/home/jb/webjosue/FlaskENV/bin/gunicorn --workers 3 --bind unix:/home/jb/webjosue/my-page/my-page.sock -m 007 wsgi:app

[Install] WantedBy=multi-user.target

server { listen 80; server_name (ip address here);

location / {
    include proxy_params;
    proxy_pass http://unix:/home/jb/webjosue/my-page/my-page.sock;
}

}



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!

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.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.