In this article, we are going to cover how to setup a WordPress website through DigitalOcean®, an excellent and easy-to-use cloud-based hosting provider. In addition to setting up our WordPress site on a virtual server, we will also cover how to install a free SSL certificate from LetsEncrypt® through our DigitalOcean account.
What is DigitalOcean?
DigitalOcean was established in 2011 and quickly generated over a million users. It has become one of the largest cloud hosting providers due to its simple dashboard interface, robust feature set, and painless scalability.
Let’s get started!
First, let’s begin logging into our DigitalOcean account. If you don’t have an account, you can easily register for a new account by clicking the link below.
Creating a Droplet
After logging in, we are taken to our DigitalOcean dashboard which includes six menu items, namely Droplets, Images, Networking, Monitoring, API, and Support. The first tab entitled Droplets is where we’ll begin.
If you’re new to DigitalOcean, you may be asking “What is a Droplet?” A Droplet is a fancy term DigitalOcean uses to represent a virtual server. It’s rather clever since a droplet is the smallest unit of measurement in the ocean.
As expected, since we don’t have any existing droplets, we begin by clicking on the “Create” drop-down button and select “Droplet” to create a new Droplet and start the configuration process.
DigitalOcean simplifies the installation process through their built-in one-click installation options, which we access by clicking on the “One-Click apps” tab.
Since we are setting up a WordPress website, we can locate the WordPress one-click app. Here, it is located at the bottom and entitled “WordPress 4.7 on 16.04”.
By launching the WordPress one-click app, DigitalOcean will automatically create a new virtual server (a Droplet) that is pre-configured with Apache, MySQL, PHP, LetsEncrypt, and of course, WordPress.
If by chance you aren’t familiar with any of those terms, don’t worry. In summary, the DigitalOcean’s one-click app will install everything that is required for WordPress.
Selecting a DigitalOcean Plan
We first need to choose the appropriate plan for our Droplet. For our website, we are going to select the first available size, which happens to be $10 per month. This package includes all of the resources we need; however, we can always resize the droplet in the future if we need additional features. Also, we can also add block storage, for example, if our site were to require additional storage space.
Pick a Location
Next, we need to specify a droplet location; which is the data center location for the website. If you are in the United States, we recommend going with either San Francisco or New York and selecting the option that is closest to home. Note that it doesn’t matter which number you select out of the three options, which can be either 1, 2, or 3, for each location.
The last and final step in creating a droplet is to assign it a hostname. The hostname can only contain alphanumeric characters, dashes, and periods. Since DigitalOcean is only hosting our website, it is wise to assign our website’s domain as the hostname, for example, we would simply use planetwp.com as our hostname.
Next, let’s go ahead and click the “Create” button to build the Droplet.
Enabling the WordPress Install using Putty
After successfully created a Droplet, we will receive an email with our Droplet’s credentials, namely the:
- Droplet name
- IP address
- and root password
For exemplary purposes, let’s enter the IP address into the browser. Upon doing so, we see the message “Please log into your droplet via SSH to enable your WordPress installation.”
To log into the droplet via SSH, we will need to use a command line tool. Our favorite command line tool is Putty. If you have not used Putty before, you can download a copy at the following link: http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Once Putty is open, we will simply enter the IP address in the Host Name (or IP address) input box and click open.
A popup may appear that prompts us to trust the host. If that’s the case, click the Yes button.
In the new window, Putty is going to ask us for username, indicated through the “login as” field. We are going to type in the username from the email we received, which is “root”. We are then prompted for the password. Simply copy the password from the email and paste it here.
On our first login, DigitalOcean requires that we create a new password. We always recommend that you come up with a strong password that is hard to crack, such as one with a minimum of 12 characters and includes an uppercase, lowercase, special characters, and numbers.
Now that we have created our password, let’s head back to the browser and enter the droplet IP. The WordPress Install Wizard will appear, but don’t run the install wizard just yet. Reason being – if we complete the wizard now it will install WordPress on our IP address and not on the domain we want to use. Instead, we need to point the domain at the virtual server (aka Droplet) first before completing the WordPress Install Wizard.
Instead, we first need to point the domain at the virtual server (aka Droplet) before completing the WordPress Install Wizard.
Pointing the domain at the Droplet
To point the domain at the Droplet, we need to update the domain’s DNS (A Record) to point at the Droplet’s IP address. In this example, I will use the domain sleepexam.org, which has already been registered at Namecheap. This process may vary slightly depending on where the domain is registered; nevertheless, if you run into challenges, the friendly tech support staff at DigitalOcean can quickly help you update your domain’s DNS.
How to update the domain’s DNS for Namecheap:
- Click the “Manage” button next to the domain name on the dashboard.
- Open the “Advanced DNS” tab.
- Click “Add New Record” and select “A Record”. In the Host field type in “@” and in the IP address field type in the Droplet’s IP address.
- Delete the other records with the @ in the host column and the current CNAME record.
- Create a new CNAME by clicking “Add New Record” and selecting “CNAME”, in the Host field enter www, in the target field enter the domain name.
Feel free to grab a coffee, take a jog around the block, or however else you kill time since we’ll need to wait roughly 30 minutes for the DNS to propagate.
We can easily check the progress of our DNS by visiting WhatsmyDNS.
Enter the domain, select “A” from the drop-down, and click the search button. The IP address for the droplet will appear for all countries if everything was setup properly.
Now that the DNS is properly pointing to the Droplet, we can now return our domain to complete the WordPress Install Wizard. Upon completing the Wizard, we now have a fully-functional WordPress website.
Installing an SSL using LetsEncrypt
Let’s take this one step further and setup a free SSL from Let’s Encrypt. For reference, SSL stands for Secure Sockets Layer and is the standard security technology for establishing an encrypted link between a web server and a browser. This link ensures that all data passed between the web server and the browser remain private and secure.
It’s critically important that all sites have an SSL. In the past, you’d have to pay for an SSL; however, through DigitalOcean, we can install a free SSL from LetsEncrypt. Here’s how it’s done:
For starters, we want to redirect all non-secure requests to the secure version of the site.
We do this by entering the following command line in Putty. Note: Be sure to replace “example.org” with your domain.
letsencrypt –apache -d example.org
Next, enter the appropriate contact email address for the SSL certification, click OK, then click Agree, and select Secure.
By doing this, LetsEncrypt will automatically redirect all insecure traffic to the secure request and eliminate the extra step associated with setting this type of redirect in the .htaccess or having to install a special third-party WordPress plugin.
After clicking OK, we will see the message that says “Congratulations! You have successfully enabled https://example.com”.
In another article, “How to setup CloudFlare with WordPress,” we will demonstrate how to install CloudFlare as a CDN, DNS, and Firewall on our freshly created WordPress website. Ultimately, this will make your site load faster while adding additional security.
We hope you found this article helpful. If so, please share it with your friends or like it on Facebook.