sic
By:
sic

Setup subdomain from Bluehost on Digital Ocean droplet.

November 13, 2017 577 views
Apache Ubuntu

This has been asked many times before, I know, I've read lots articles on DO and other sources all saying very much the same thing, but can't seem to find the issue.

I have a couple of subdomains my client has hosted on Bluehost with the zone file setup correctly. All works well. But now I want to host 2 of the subdomains on my DO droplet instead.

I have successfully added full domains and subdomains on two of my DO droplets following all the directions in the past without issue. The difference is this time the main domain name is hosted on Bluehost with their name servers and the subdomains are to be hosted on DO. The subdomain has been added to the zone file on Bluehost and it works, but when I change the A record to point to my DO droplet IP and then setup a new domain in DO and a simple A record pointing to the droplet IP, my default domain website always shows up when I load the site in my browser. I've also added CNAMES and tried other things.

I've got the sites added to sites-available and sites-enabled and the conf files were copied from other working sites with the paths changed. The paths exist and files are there. I've used sudo a2ensite and restarted apache. I have pinged the subdomain and it points to my DO IP address.

Access/Error logs say nothing.

Using Ubuntu 14.04/Apache.

Why would my default site keep showing up instead?

Is there an issue with name servers?

What have I missed that other articles aren't saying?

1 Answer

You should create a separate virtual host configuration file for your new domain on DO droplet. Having a DNS A record (or CNAME for that mater) pointing to your droplet is not enough, as Apache must know how to process the domain. If it does not find a matching configuration file, it will redirect (or use the config of) the default site (e.g., 000-default.conf).

  • Thanks for your answer. I actually do have the appropriate virtual host conf files setup in the "sites-available" and "sites-enabled" folders (I mentioned this in my original post). I have copied them from existing domains I have setup that work properly and changed the relevant details.

    I think the problem seems to be with the fact that I'm not using DOs domain name servers, but using the other host's for the main domain and then I am only pointing a subdomain to DO using an A record and my DO Droplet IP.

    Am I right to believe that I can host the main zone file on another host (Bluehost) and the use other host's domain name servers for the "main domain" (example.com), and then point a sub domain (stage.example.com or even the main domain) to another host like DO, as long as my A record points to the IP address of my DO droplet... and as long as I have the domain or subdomain setup in the DO control panel and have the virtual host config files setup?

Have another answer? Share your knowledge.