Hosting Horrors Part 1
Once I started hosting sites for clients it got to be a bigger issue. The latency and uptime was all over the place. My sites were going down every week. The hosting provider tried to say that they didn’t go down, they just didn’t respond for a while, which seems like an academic distinction to me. Unresponsive is unresponsive. I then migrated all of my sites to a VPS provider. It was pretty good, but I didn’t realize that they were, “Managed,” VPS instances. That means that you don’t have root access, it’s really just shared hosting with less bells and whistles. However the performance was MUCH better. I couldn’t do any of the server optimizations that I really wanted to though. What if I don’t like the compression extensions they’re using? Heck, what if I don’t want to use Apache for a web server? Get a dedicated server was the response from their documentation. I’ve been system administrator on some dedicated servers and I’ll pass. They’re also really expensive. If I need that kind of performance I’d prefer to load balance multiple servers so that I have HA (high availability) and fail-over. Although load balancing your load balancer is an interesting problem. If you want that kind of fault-tolerance with dedicated servers you’re also paying for MULTIPLE dedicated servers which is even more expensive.
After all of that I moved to an awesome service called Digital Ocean. I’ve been with them for a while and I use a similar service in Australia called Binary Lane.
Domain Registration
So with Digital Ocean I started hosting all of my sites. I also migrated all of my domains off of my previous hosting provider to a DNS only service. Digital Ocean doesn’t do domain registration which is good, because it forced me to move my domains to a domain registrar that only does that. It’s a good move, because then if you move from one hosting provider to another you don’t have to pay to re-register your domains. I was out over $100USD this year before I realized that. I use Hover, and highly recommend them. They even helped me with transferring/registering some .com.au addresses, and that is an extreme pain. Did you know you need basically an Australian Social Security Number (ABN) to register a .com.au domain? It’s a pain.
DNS Hosting Settings
So DNS is a bit of a black art in a lot of tech. A lot of people say they know DNS and what they really mean is they know the difference between an A record and an MX record, or they know that DNS translates IP’s into human readable URL’s. The core of DNS is simple, but the ways it interacts is not. Also kudos to anyone running a DNS server is a pain. It’s not too bad on Windows, but the O’reilly book on BIND (the major Linux based DNS server) is huge. I got asked in the early stages of my carer to start running a server for the company, and I agreed (because I was an intern and wanted to please). I looked into it and was floored. Fortunately the company wasn’t great on keeping track of it’s ideas so it died a slow death.
Later on in my career, pretty recently actually, I worked on a product that intimately used DNS. The new standards that doctors and hospitals use to communicate with each other and patients use DNS as an authentication layer. It uses DNS cert requests to verify PKI (public key infrastructure). A couple of my colleagues and I looked through a whole lot of DNS routing stuff before we got a handle on exactly what the order was. For instance if I go to a subdomain for a domain does it query the NS record before the A record? It seems like a subtle difference, but depending on that it can go to an entirely different server that doesn’t have the records you need to resolve. We developed a joke that when stuff didn’t work you’d just say, “I don’t know, maybe it’s the DNS?” Now we’re going to go over how to set your DNS settings for your hosting from your registrar then set the other settings on your host.
So in order to host your sites at Digital Ocean and have your domain registration with Hover then you’re going to need to change your name servers for hover. You can set them in the domain settings. You need to change them to the following:
ns1.digitalocean.com
ns2.digitalocean.com
ns3.digitalocean.com
Then you’re going to need to change the DNS settings on your Digital Ocean account. You can do this by navigating to networking along the top, then going to networking. Then you can select domains. Add the domain that you have. then go into it. You’re going to want to set an A record for both
@.yourdomain.com
and
www.yourdomain.com
I’d also create an A record for
mail.yourdomain.com
and then create an mx record for
mail.yourdomain.com
You should see the IP for your droplet get entered into your records. Set all the A records to that IP. You can also request a floating IP and use that as well. I just used the one that was included. If you can’t find it then SSH into your VPS and run
ifconfig
That should give you the IP (it’s not the loopback one).
Your DNS should work now. You can verify by running nslookup on your machine (if you’re Windows). However for the purposes of this I’ll just recommend using an online service. A good DNS server to check against is 8.8.8.8. That’s Google’s DNS and they’re pretty good. I also sometimes use 4.2.2.2 which is Verizon.
That concludes Part 1. Next time I’ll go over getting your VPS and the management layer of your server set up. What, you can’t wait for the next part? TOO BAD! BWAH HA HA HA!!! Sorry, but these walk-throughs get super long, so I’m splitting them up. If people hate that let me know in the comments. It seems like a few thousand words in a row is excessive, but what do I know?