Want to direct subdomain to external VPS

I bought a domain on in external service, transferred by nameservers over to use Netlify’s, so now Netlify manages the associated DNS records.

Things work fine for my Apex Domain and www domain.

I created an API that’s hosted on a VPS Provider (Digital Ocean), and I’d like to assign the IPv4 there to api.my_domain. I used Netlify’s DNS management UI to create an A record that points api.my_domain to the IPv4 of my digital ocean server.

When I go to the api.my_domain I get “This site can’t be reached”. Do I need a CNAME record, too or something? If yes, should the value for it be the IPv4? Or am I missing something else here?

An A record should be correct if you are using an IP. “this site can’t be reached” is not a message our service sends; could be from digital ocean, a firewall, or your browser…

If you’d like to let us know the hostname, we’d be happy to take a look at the config and see if we can advise?

Hello! I have this exact same scenario, with Digital Ocean. I have a domain purchased from NameCheap and pointed to Netlify’s DNS servers and successfully linked the main site mywebsite.com into Netlify. Now I want api.mywebsite.com to be server-side middleware in my DigitalOcean VPS, what do I need to configure to make this work?

I’d suggest you probably need to start by defining that hostname in our DNS panel. Since you used a made-up hostname, I can’t give you a direct link to that page, but select the domain from here:


…and then add a record, using the settings that Digital Ocean suggests (likely an “A” record that points to your droplet at DigitalOcean).

That’s the only thing you’ll configure at Netlify; the rest would be on the Digital Ocean side: (SSL, set up your service there, enforce access control, etc)

Excellent! Thank you so much!! Now I can continue with my tests. Just in case I ever need to in the future for whatever reason, what if I were to host my main domain mywebsite.com on DigitalOcean so my domains’ DNS records were pointed to Digital Ocean’s DNS Manager. Would I be able to add an A record in Digital Ocean’s DNS and point it to Netlify for api.mywebsite.com? Or something along those lines?

Only one person is hosting your DNS, Raul (for the single domain that remains on the page I linked, today that is Netlify). You’d configure a record here, using the settings their service recommends (e.g. “A record with value”). To generalize: whomever is hosting DNS as shown through whois (demo below) would be the place to make the configuration change :slight_smile:

 $ whois netlify.com
   Domain Name: NETLIFY.COM
   Registry Domain ID: 1862188883_DOMAIN_COM-VRSN
   Registrar WHOIS Server: whois.name.com
   Registrar URL: http://www.name.com
   Updated Date: 2020-05-08T17:20:26Z
   Creation Date: 2014-06-09T19:55:48Z
   Registry Expiry Date: 2021-06-09T19:55:48Z
   Registrar: Name.com, Inc.
   Registrar IANA ID: 625
   Registrar Abuse Contact Email: abuse@name.com
   Registrar Abuse Contact Phone: 7202492374
   Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
   Name Server: DNS1.P04.NSONE.NET
   Name Server: DNS2.P04.NSONE.NET
   Name Server: DNS3.P04.NSONE.NET
   Name Server: DNS4.P04.NSONE.NET
   Name Server: NS01.NETLIFYDNS.COM
   Name Server: NS02.NETLIFYDNS.COM
   Name Server: NS03.NETLIFYDNS.COM
   Name Server: NS04.NETLIFYDNS.COM

From the above example, you can see that netlify.com is registered through name.com ( Registrar URL: http://www.name.com), but the DNS hosts for netlify.com are NSONE.NET and NETLIFYDNS.COM, which is where records need to be changed. In the case of your domain, you’ll see NSONE.NET in that output, and you’d make the change here (and we tell NSONE when you edit/delete/add records).