Easily configure a performant, secure, and stable NGINX server.Learn More
New Django site on Nginx went to 502 few days after setup
I set up a django site on a new droplet with Uwsgi and Niginx a few days ago following this tutorial
I had the site set up correctly with the Django ‘It worked’ message displaying and Nginx reporting everything was setup correctly.
I then came back to the site (nothing else was done to it) 2 days later to see a 502 message and also I was unable to ssh into the server. I had to reset the root pw and login via the console and set port 22 to allowed in ufw which I thought was strange as I had logged in and out via ssh many times when doing the setup a few days before.
Next I went through all the uwsgi and nginx config files and made sure everything was ok, nothing had been changed so I then restarted Nginx, still the site show 502, finally I ran this
sudo systemctl start uwsgi
and then the site was back to normal.
Does anyone know what caused this and is it going to happen again?
In the Nginx error logs I see something about the sock file:
connect() to unix:/run/uwsgi/firstsite.sock failed (2: No such file or directory) while connecting to upstream
but the sock file was created just fine the first time and was still there.
Also it was showing some errors referring to phpmyadmin e.g.
2017/02/09 07:06:49 [crit] 1615#1615: *47 connect() to unix:/run/uwsgi/firstsite.sock failed (2: No such file or directory) while connecting to upstream, client: 126.96.36.199, server: my-ip, request: "GET /phpmyadmin HTTP/1.1", upstream: "uwsgi://unix:/run/uwsgi/firstsite.sock:", host: "my-ip", referrer: "http://my-ip/phpmyadmin"
why is phpmyadmin there when this is a Django site?
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.×