502 Bad Gateway with DigitalOcean/Django?
This is my second time setting up a server and I had this same problem last time, but I'm still too much a noob to fix it. Everytime I go to my ip address the website works fine, but whenever I use the domain name it gives me a 502 Bad Gateway. This is my error message:
"2017/03/10 15:12:03 [error] 1652#1652: *30 upstream prematurely closed connection while reading response header from upstream, client: 173.174.110.165, server: _, request: "GET /favicon.ico HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/favicon.ico", host: "domain_name", referrer: "domain_name"
So the domain is obviously working because I'm getting logs when I use it, but it just gives me a 502. My allowed_host says this: ALLOWED_HOSTS = [domain_name, ip_address]. Is this a Django problem or will I have more luck posting in the sysadmin subreddit?
Posted Mar 10, 2017, 3:20 PM UTC · edited
Try going into your settings.py and, if at the bottom, there's the ALLOWED_HOSTS = ip_addresses() you can comment it out or add a + to include it in the hosts (ALLOWED_HOSTS += ip_addresses())
That was an issue I had when I used the 1-click django from DO.
YOU DA BEST! Thanks! This fixed it. I will be forever greatful.