简体   繁体   中英

Digital Ocean: One Click Django Won't Route My Domain, Bad Gateway

The one click django with ubuntu 16, nginx, and gunicorn is not routing my domain name. When I type the IP address into the address bar it works but when when I use the domain I get 502 Bad Gateway nginx/1.10.3 (Ubuntu) . Looking at the nginx error log I see:

2017/10/16 19:05:18 [error] 23017#23017: *80 upstream prematurely closed connection while reading response header from upstream, client: redacted server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/home/django/gunicorn.socket:/"

I followed the steps here: https://www.digitalocean.com/community/tutorials/how-to-point-to-digitalocean-nameservers-from-common-domain-registrars#registrar-godaddy

and here: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean

But I must have done something wrong. Anyone have any ideas how to solve this. I am brand new to DO, Django, and really web dev.

updating NS servers take up to 48 hours. If you already updated 48 hours ago, then clear browser cache then again access to your domain. Normally after 24 hours, you can access to your domain over the browser. Secondly, check the access to /etc/nginx/sites-available

Your upstream in the nginx configs is wrong, see the nginx log: http://unix:/.... ? It should be either http://... or unix:/... - depends on how your Django setup is configured.

Check your nginx configs in /etc/nginx/sites-available/ or /etc/nginx/conf.d and fix the location of the upstream and reload nginx to fix the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM