Easily configure a performant, secure, and stable NGINX server.Learn More
Uploaded new Flask code, socket file disappeared, how do I bring it back?
I start this off with the fact that I am a python developer and I know very little about server management so this is all a learning curve for me.
I created a new Ubuntu 16.04 droplet and I followed this tutorial - https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-16-04. All was well and it worked.
I used Filezilla to move my flask application from my localhost to the droplet. I overwrote the old app.py with my app.py. wsgi.py was unchanged nothing else should have changed.
sudo systemctl restart myproject and went to view the server from my browser and I received a 502 error.
Looking at the error log I have this:
2017/01/29 23:21:37 [crit] 18456#18456: *1 connect() to unix:/home/user/myproj/proj.sock failed (2: No such file or directory) while connecting to upstream, client: xx.xx.xx.xx, server: xx.xx.xx.xx, request: “GET / HTTP/1.1”, upstream: “http://unix:/home/user/myproj/proj.sock:/”, host: “xx.xx.xx.xx”
Which suggests there’s no socket file. I ran
ls -al in
/home/user/myproj and I can verify it’s not there. I didn’t delete it so I am not sure what happened to it and how to make it return.
I’ve verified the nginx.conf in /sites-enabled for this project and in the systemctl .service and all the info matches up.
I tried restarting/reloading my project.service, nginx and even a reboot of the server and no luck.
How do I properly return this socket file?
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.×