By johnpham92
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!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
For the records: Be sure about the configuration of allowed hosts in Django Settings!
I wasted some hours to figure out that I forgot to also add the domain name there, so:
ALLOWED_HOSTS = [server_ip, domain1.com, domain2.com]
This comment has been deleted
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.