If you don't more or less know what you are doing for setting up a webpage, you probably want some other implementation, or really a company to do it for you.  Having said that, I doubt google would of pointed you to this page if you weren't looking for more. 


 I wanted ultimate flexibility and an deeper understanding of how everything fits together, as I'm planning on doing java development on the back end to serve custom webpages/applications, in addition to some CMS managed statics websites, as I didn't want everything to be done by hand from an app server.  Also, it needs to seem to be of the same make and model, users should not have any inkling that the whole backend has changed for them from a CMS managed site to a App server managed site with a simple click.  At the moment, that last part is just a bit of dream, as I haven't gotten there yet.

Anyway, I decided I would like to set up my own server, but I didn't want to deal with maintaining the hardware myself and redirecting some IP to my house (let alone having speed issues if I ever got anything past trivial traffic... might happen, you never know.)  Given that, I decided to install an externally hosted full control linux box somewhere in someones cloud!  Digital Ocean was the choice, I didn't bother researching the "best" option there, I took it on faith from a friend, whose strength is making those calls.  Also, he is very paranoid about security, which is another weakness of mine, since I'm pretty cavalier when it comes to that.

Since I'm writing this article for public consumption, and I happen to know that public is pretty much just going to be me, so without further ado, future me, this is how I did it.  (Yes, I know you forget how you did things...  and since I/you/we did this last night, and already have to dust off the details...)

There are three things that have to line up to make a multi-domain Digital Ocean droplet work in this fashion.  This article does not address the app server aspects of the project, as well, i haven't done them yet.

Here are the 3 three that need to line up to make this work

  1.  The Domain registrar (godaddy in my case) must have the DNS configuration point to Digital Oceans Name servers.
  2.  Digital Ocean's droplet I created for this project must have a Zone file for each domain I care about, and it has to point at the droplet, along with the appropriate A & CNAME record types.
  3.  The webserver on the Droplet itself has to be configured to handle the traffic from the domains, and that is handled by a Virtual Host setup.

Here they are in detail:

1. Log onto godaddy, and after some futzing around on the !*!@#!! ad filled piece of crap page, realize that the configuration you need is under the "Andrew" drop down Quick Links, for "Manage My Domains".  Future me, if you are lucky, clicking this might get you most of the way there, but you'll likely have to reset your forgetten account name and password.  Bummer for you.

https://dcc.godaddy.com/


On each domain block, there is a little drop down in the top right

Click on Manage DNS

And then change the nameserver to digitaloceans
 

Repeat for each domain.

2)  So now you have to set up the Zone files for Digital Oceans Droplet.  I have one droplet, and it's small, but it didn't seem to care how many sites, so cool, should save me lots of money.  I did learn that the Zone file isn't per droplet like I expected, but it is per domain.  Therefore, you have to add each domain to the droplet one at a time, and it's a bit clunky, in order to edit the file you have to go to addDomain for the droplet, and find the domain from a list, and click on the edit icon.  There also isn't an easy way to add another domain, you have to go back to the droplet page and go through from top everytime.  No big deal tho.

So, click on "Droplets" select the drop you care about, click more, click "Add a Domain" to edit or add a new.  The existing domains for a droplet are in a list on the next page.

 
Then you make the Zone file for that domain point to the IP with the catch all @ symbol, and add a * CNAME record to @ (which converts to a domain name with a "." at the end for some reason).   FWIW, a CNAME record point to the NAME value of the domain as an alias, where the A record points to the IP.  Since apache uses names for virtual hosts, I think you want to CNAME option, not the A record.  Normally they would be interchangeable.
Anyway, it look like this when all is said and done.


 
The domain I'm editing is miscmagic.com(not shown) with the '@' 'A' record here saying point the domain to this IP.  The * CNAME record says all subdomains anyone enters should be redirected to the miscmagic.com domain(which in turn points to the IP).
So www.miscmagic.com gets redirected to miscmagic.com, as does bobisyouruncle.miscmagic.com for that matter.
Repeat this setup for every domain you want pointed to this droplet.


3)  Finally, we have to setup the apache configuration.  So I didn't know anything about Apache configuration before this, but the good thing is I still don't know much about it.  Why is that good?  Well, it won't get me a job(but really, I'm never going to be an admin  uuhg!) but it does mean it was pretty straightforward.  If I was an expert at configuration at this point, it would be bad news for apache.  I just want it working, and working correctly; got that with this... pretty sure anyway.
So you need a couple of commands for apache to update the configuration for the goals I have here.  Mainly I want one web server to handle all the incoming domain traffic.  You have to tell apache about each domain, and each domain needs to have a configuration file.  The commands are a2ensite and a2dissite.  Why they didn't make it add and remove  (a2addsite a2rmsite) I have no idea, but anyway, those two commands will allow you to add domains and remove the domains from apache. 


For examle,
  sudo a2ensite andrewmajercik.com.conf


And the conf file lives in /etc/apache2/sites-available


One point of confusion I had, was the command will run and seem like it worked without being root, but not actually work.  Make sure you sudo or have root permissions or you may be banging your head into a wall.

There are really only a couple of things to do:  copy an existing apache webserver conf file, and name it wisely, change the server name, add an alias, and set the document root.


 
The servername needs to match the domain in question you added to the droplet, notice the lack of "www" in the example.  (I wouldn't make a mistake like that ! :) )   The real key here is the ServerAlias, I wanted all subdomains of each primary domain to be directed to the proper document root.    This server alias says send to drumboneblog.com and request regardless of prefix(sub domain) in the URL to the same location.... in this case /var/www/drumboneblog.

For the DocumentRoot I used a different directory for each domain, but you can have it point to anywhere.  In one those directories I have a joomla install... it seems to work fine and happily with the standard static page index.html's I have in the the other location.  I"ll add another CMS or two at some point, and update this is I have more things to do!

After you have added a new conf file for each domain, you'll need to restart apache.  (I think there is a way you can add it without a restart as well)

sudo service apache2 restart

I'm sure you'll be cursing at something screwed up in a moment when you test it... but it worked for me!  (and yes, I did a fair amount of cursing until I figured what needed to be lined up.)


Good Luck,

   Future Me, Still probably Andrew