So, most websites out there assume you already have a domain name somewhere that’s routed to Digital Ocean and a droplet or something similar already setup on their service. This blog DOES NOT. This is the soup-to-nuts setup for setting up a WordPress blog on Digital Ocean having just purchased a domain name on GoDaddy.
Create Your Droplet on Digital Ocean
First, you need a droplet. A droplet is basically a little computer running in the cloud (get it, droplet). If you’re super computer savvy you can create a baseline Ubuntu Droplet and then install all the WordPress dependencies yourself. However, Digital Ocean has come out with the nifty one click WordPress Blog installer, which you can find by clicking here. If you’re logged in, it’ll take you to the Create droplets page, otherwise you’ll log in to get there 🙂
For a WordPress site without too much traffic (<10K hits per day), I’d recommend a “Basic” account. If you’re reading this blog… that’s you! You’re just getting started 🙂 A “Basic” account is a shared resource. They partition parts of a computer for you, so you’re sharing one whole server with other people. Who cares?! You don’t see each other and buying your own host would be super expensive.
Go ahead and put in your payment method and click through. You’ll get to a bit more config. Make sure to name your droplet something you’ll remember, especially if you plan on having multiple of them associated with multiple different sites and projects.
After that, the options don’t really matter too much and can updated really easily later. I like to enable IPv6 and monitoring and I also like to configure ssh keys for easier and more secure login instead of using passwords. That’s a personal preference. I don’t pay the extra $1 per month for back ups because, well, I can just back it up myself. Any decent developer is going to be using a GitHub or other version control mechanism for their repos and even WordPress sites can be dumped to an xml file that’s a few MBs at most and loaded into a shared drive or folder with corresponding dates. You really should be doing these things as standard practice.
Mapping the domain name server (DNS) allows you to route the website you own over to your new little droplet from where content is served. A domain nam is basically an easy way for people to remember who you are (e.g., stephaniemoyerman.com) but in the background all it’s doing is looking up a computer on the web at a specific IP address. The computer then takes the request, does some fancy computing, and serves up data that renders into your webpage. Simple, right? 😉
It’s a little more complex than this even. If you buy a domain from GoDaddy.com (where I buy), then you can host it right on GoDaddy’s own computers (e.g., servers) and they’ll route it up for you. But, if you want to use your own server that you just paid for on Digital Ocean, you need to tell GoDaddy to send your website requests there via a DNS config. Then you ALSO need to tell Digital Ocean to serve the website on your exact little droplet. Basically, you buy from GoDaddy, they send all your traffic to Digital Ocean, Digital Ocean routes it to your little droplet/server, and the server fetches and delivers the content that finally shows up on the page. If none of that made sense it doesn’t matter… just follow the config below anyway.
This is JUST for GoDaddy. If you use any other hosting service, you need to do the same thing just the steps won’t be exactly the same.
Login to your account on GoDaddy. Once logged in, scroll down on your homepage to your domains.
Click on three dots in the upper right corner of the domain and a dropdown will appear. Select “Manage DNS”.
This will open up the DNS management page. Scroll down to find the option for Nameservers.
Click on the “Change” button, which brings you to the configuration page. On that page, click on “Enter my own name servers (advanced)”. It’s not advanced, I don’t know why they say this.
For DigitalOcean, use the nameservers specified in the configuration below. To enter 3 instead of the default 2, use the “Add Nameserver” option which will create a 3rd text box. Click the “Save” button when you’re ready.
At this phase, a pop up will appear and you will have to consent to the changes. You might also have to verify your identity. Go ahead and do it.
Done with the Nameservers on the GoDaddy Side!
Configure Your Site on Digital Ocean
Login into your Digital Ocean account. To add the domain, click on the “Create” button in the upper right and then click on “Domains/DNS” as shown below.
This will bring up the domain page. Add your domain here and link it to the droplet you created in part 1. Click “Add Domain”. This should create all the records for you that you’ll need if you started with the root domain. The next page will show the routing to the name servers and your domain being routed to the IP of your droplet.
Now you’re all setup! Now we need tell our server to actually DO SOMETHING when this domain reaches out to it.
Configuring a WordPress Blog on Digital Ocean
First, it’s nice to create a project containing all the resources for this entire blog.
<< info here about project creation >>
So, remember that droplet we setup way back when? It should be done now. So, we’re going to have to finish the configuration and hook everything up to our site. This requires us to ssh into the droplet.
Open a terminal and ssh in, using the default root account and the IP of your droplet, which can be found on the main page.
Copy this IP by mousing over and clicking copy. Then, login as root by ssh’ing from the command line:
>> ssh email@example.com
Put in your password if you’re not using ssh-keys. Upon login, the prompts will ask you to configure your WordPress site. If you’re ok with the default MySQL database that ships with WordPress, then go ahead and just follow the prompts directly. Otherwise, follow the tutorial here under “Connecting to a Database” to reconfigure and use your own Digital Ocean database. For me, I’m ok with default. It’s quite an interactive prompt, so keep it rolling and keep answering questions for a few minutes.
Once it’s finished, if you did everything right and mapped your DNS’s, you can finish configuring the site by going to the domain name in your browser (this might take a bit for full propagation, don’t get frustrated).
Oh snap! It worked. To login, head over to your website with the wp-login.php page. For us, this would be thedetach.com/wp-login.php. You can login using the username and password you set during the configuration in the terminal. Hope you remember it!
That’s it! Super easy from start to finish. Once you have the process down it’s really only a few minutes to get going!