Question
Django NGINX configuration with DNS
Hi,
I used the one click django install to create a droplet for my blog. I have succesfully gotten the site to run, and it loads well via the the IP Address (http://104.236.117.75/). However, when I use my domain name (johnpham.me), I get a Bad Request (400) error. I purchased the domain from namecheap and redirected it to use the DO nameservers. I set it to @ for the ip address. I was thinking it was a DNS propagation issue, but whois lookups for the domain shows the digitalocean nameservers. Pinging the domain name works. Domain lookups reveal the correct IP, but I still can’t visit the site from the domain name.
I’ve configured my allowed hosts [“*”] in settings.py to see if I can get anything to work.
Here’s the relevant part of my NGINX settings:
Could the root, index, upstream app server be the problem? Those don’t refer to anything that I’m currently using, but since it loads fine with the IP address I didn’t think I would need to delete it.
upstream app_server {
server 127.0.0.1:9000 fail_timeout=0;
}
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name johnpham.me;
keepalive_timeout 5;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_pass http://app_server;
}
Any help or insights would really be appreciated!
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.
×