Setup subdomain from Bluehost on Digital Ocean droplet.

November 13, 2017 89 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).

Have another answer? Share your knowledge.