I reset my droplet password just now. Now I tried “service nginx status” and it says its not running. The error in the logs was:
[emerg] 3956#0: duplicate upstream “app_server” in /etc/nginx/sites-enabled/django.save.1:1

I was able to start the nginx server by deleting the /etc/nginx/sites-available/django file as there was the same file in /etc/nginx/sites-enabled/ and maybe thats why the “duplicate upstream” error. Now nginx is running.

But,now when I open my site now I get a 502 Bad Gateway error. The error in nginx log is:

*8 connect() to unix:/tmp/gunicornaakar3dp.in.sock failed (2: No such file or directory) while connecting to upstream, client:, server: _, request: “GET /favicon.ico HTTP/1.1”, upstream: “http://unix:/tmp/gunicornaakar3dp.in.sock:/favicon.ico”, host: “aakar3dp.in”

Did I do something wrong here? Please help.

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.

2 answers

I think you delete the file with the correct upstream configuration, what the error shows is there is no socket running on /tmp/gunicornaakar3dp.in.sock

Check your socket (not sure if is a php or something else socket) configuration and correct accordingly.

Problem is still the same, /tmp/gunicornaakar3dp.in.sock does not exist, so you need to find out which socket django uses and correct nginx site conf.

check if there is any other .sock on /tmp but you should find it in django config too

Submit an Answer