Connecting domain name to django webserver

Viewed 4184

Currently, I have a Google Domain www.tanrunen.com. I would like to link it to my Django blog on 165.227.49.137. But I couldn't get it to work.

I'm not using the One-Click install for the Django App on DigitalOcean as it doesn't support Python 3.6 & Django 2.11. Instead, I just selected a blank Ubuntu server and installed Python 3, Django 2, Supervisor, NGINX, Gunicorn manually. Right now the site is live on 165.227.49.137 but I'm struggling to link it to my domain name.

Here are things I've done:

  1. I've added ns1.digitalocean.com, ns2.digitalocean.com, ns3.digitalocean.com to the nameservers on Google Domain.

enter image description here

  1. On DigitalOcean networking tab, I've added my domain name and direct it to my droplet IP address.

enter image description here

  1. In my NGINX configuration file, I've added my domain name to it.

    server_name 165.227.49.137 www.tanrunen.com;

  2. In my Django project directory, settings.py have my domain name in the list. ALLOWED_HOSTS = ['*','www.tanrunen.com','tanrunen.com']

  3. I've waited for a full 12 hours after adding the nameservers on Google Domain.

I understand that since I didn't use the One-Click install for Django, there may be additional steps needed to link my domain name to my site. If there is, do let me know more on how to do it.

1 Answers

If you enter 'tanrunen.com' into google your website appears.

I believe that your issue is you DigitalOcean DNS records.

You currently only have 'tanrunen.com' referenced. To get 'www.tanrunen.com' working I would add a second A record where the Hostname is '*.tanrunen.com'.

Additionally, you should add a CNAME that has a Hostname of 'www.tanrunen.com', which redirects you to 'tanrunen.com'.

Related