Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup DNS configuration with Netlify and Digital Ocean combined?

I have bought a domain my-domain.com at Namecheap. My goal is to use subdomains of my-domain.com with Digital Ocean and my-domain.com with Netlify. Desired result:

  • my-domain.com redirecting to Netlify
  • subdomain1.my-domain.com redirecting to Digital Ocean
  • subdomain2.my-domain.com redirecting to Digital Ocean

At the moment, my setup with Namecheap is this: Current Namecheap setup

And Digital Ocean: Current Digital Ocean setup

All the DNS setup is very unclear to me, I appreciate any help!

Thank you.

like image 765
mosses Avatar asked Apr 23 '19 09:04

mosses


2 Answers

First off, let's not use the term "redirect" since that is not happening here :) That's a specific HTTP convention that neither Namecheap nor Digital Ocean's DNS will be involved in, once you've configured things correctly. It is a service they might offer, but it is not one you should use in most cases (neither Digital Ocean nor Netlify benefit from that kind of configuration and it will make at least your Netlify site less reliable and harder to protect via Netlify's automated SSL certificates.)

I work for Netlify (and use Digital Ocean personally), and suggest this setup:

  1. Use the Alternative configuration shown in this article to configure your bare domain as an A record pointing to Netlify's load balancer, 104.198.14.52
  2. Use a CNAME for your www domain pointing to your sitename.netlify.com
  3. configure your DO subdomains as A records pointing to your droplet.
like image 164
fool Avatar answered Oct 04 '22 18:10

fool


I have never worked with Netlify and Digital Ocean, but just in theory.

1) You are using Digital Ocean name servers, so you have to edit DNS records there.

2) Setup A/AAAA record for each subdomain:

  • my-domain.com with Netlify IP
  • www.my-domain.com with Netlify IP
  • subdomain1.my-domain.com with Digital Ocean IP
  • subdomain2.my-domain.com with Digital Ocean IP

Remove A/AAAA record with Wildcard (*.my-domain.com)

3) Setup your server to listen for it

like image 40
Petr Vocelka Avatar answered Oct 04 '22 20:10

Petr Vocelka