I'm not sure why I've had so much difficulty finding an easy answer to a fairly common task. I'm sure there are easy answers, and I probably haven't been asking the right questions. I'm obviously not a server admin by any means, but I can usually figure out basic tasks when needed (except for this).

I have a website - example.com - which I am using on shopify.

I want to develop my landing pages on try.example.com which I would like to be hosted on Digital Ocean.

  1. How do I point the cname to the digital ocean server? Obviously I need to set a host name of some kind on the digital ocean server, then point to that?
  2. After the domain is pointed, how do I handle its files? Is it the same thing as simply creating a virtual host to handle them?

I apologize if this question seems basic, but I'm trying to learn and I don't know what to search. I know this is possible because I've pointed other cnames from my domain to other services.

Any help is greatly appreciated. Any sort of starting off point should get me started.



Not exactly sure how Shopify works, but if the IP that example.com is pointing to is different than the Digital Ocean droplet IP that try.example.com should point to, then you want an A record rather than a CNAME record.

You can learn about the difference between the two here and here.

Digital Ocean

The droplet setup is fairly simple if you're familiar with the basics of Linux web servers. This typically involves installing nginx or apache2 and placing your HTML/PHP/JS files in the /var/www/html/ directory.


There are two parts to this.

The DNS Lookup

The browser (or other user-agent) wants to know which IP address to connect to for a given domain name. It's looking for A or AAAA records. If it receives a CNAME record, it will go and ask there instead.


nslookup service.example.com

What is the A or AAAA record for service.example.com?


service.example.com IN CNAME host.example.net

service.example.com has all the same records as host.example.net. Go ask there instead.

The browser will now go and look up host.example.net.

The HTTP Connection

Once the broser has the IP address of your server, it'll try to connect there. In the Host header (and in SNI if you're using TLS) it will tell you which host it's looking for:

Host: service.example.com

It's still the original one it looked for. It will not say that it's looking for host.example.net.

Your setup of the vhost is completely standard. It matters not whether the browser obtained the IP address through direct A or AAAA records or by means of a CNAME lookup. The browser will connect to the server identically either way.

  • Thank you for this explanation. I guess in theory one of the reasons I haven't found many answers is that most people will simply use another A record and point to the "landing page" location? – El Paso Nov 5 '19 at 17:01
  • A CNAME is handy when you're pointing a subdomain under your control to a service that someone else controls (e.g., webmail.example.com IN CNAME hosted-service.mailhostprovider.example). That way, if the mail host want to change their infrastructure, they don't need to contact all their clients to get them to update their DNS. If you yourself control all the records, it's perhaps less necessary, though still useful sometimes (only one record to update if the server moves). – TRiG Nov 5 '19 at 17:05

One of the reasons why you may be having problems creating a CNAME for example.com is because you cannot create a CNAME at the top level of a domain.

Therefore, you cannot create a CNAME for example.com that points to host.example.com.

This is from RFC1912 section 2.4: "A CNAME record is not allowed to coexist with any other data."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.