Question

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

Posted September 23, 2016 13.9k views
Nginx Ubuntu Python Deployment

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;
}

}

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.

1 answer
Submit an Answer