Setting up a virtual server with DigitalOcean can seem pretty daunting, especially if you’ve never used a cloud hosting provider before. You can’t rely on DigitalOcean’s support – agents take a long time to respond, and rarely provide useful answers. To make matters worse, much of DigitalOcean’s online documentation seems to be out of date.
That said, setting up a VPS with DigitalOcean isn’t that difficult – and in fact, much of the process is automated for you. By following a few simple steps, you can have a new WordPress site up and running in an hour or two.
This guide will show you how to create a “Droplet” (VPS) with DigitalOcean and install the necessary software for web hosting. I’ll also cover how to install and configure WordPress. It’s simple enough that even a total beginner can follow along. So, let’s get started!
Getting Started with DigitalOcean
DigitalOcean’s Droplets come as a blank slate – you can use them for a wide-range of purposes, not just for web hosting. Therefore, we’ll need to install the necessities for web hosting. Thankfully, nearly all of this is handled for you as part of an automatic setup process.
Below is the software we’ll be installing and using in this guide:
- Ubuntu 20.04
- WordPress 5.8
- Apache 2.4.41
- MySQL 8.0.21
- PHP 8.0
- Fail2ban 0.11.1
- Postfix 3.4.10
- Certbot 0.40.0
How Do I Create a Droplet?
Create a DigitalOcean account to start. You can create one for free, but you’ll need to enter your payment card details to do so.
There’s a free trial available, which lets you try out DigitalOcean for 60 days with no commitment. You’ll get $100 in free credit to play with, which is more than enough to host a basic WordPress site.
DigitalOcean offers a variety of ways to sign up. You can use a Google or GitHub account to streamline the process, or just use an email address. If you choose the latter, you’ll have to provide your email address, your name, and a password. You’ll have to confirm your email address via a verification email.
From there, you’ll need to provide a payment method. This is used to identify you. You can choose to add a card or prepay a small amount with PayPal, which can then be credited towards future hosting bills.
If you use a payment card, you may see a temporary authorization charge appear in your bank statement, but no charges are being levied. This is just to verify your bank account.
Now that we’ve got account creation out of the way, we can get to the fun stuff. Upon logging in for the first time, DigitalOcean will offer a quick and easy setup screen for a variety of different use cases. You’ll see an option for website hosting – click it to get started.
Next, you’ll see a screen with some common web hosting configurations. For the purposes of this guide, we’ll choose to deploy a WordPress server.
Which Plan and Data Center Should I Choose?
You’ll now be taken to a screen where you can configure your VPS. DigitalOcean’s VPSs are known as Droplets – and to begin the process, you’ll need to choose a Droplet plan.
For a new WordPress site, the cheapest option offers just enough resources. You can easily upgrade to a better plan at any time.
Next up, you’ll need to choose a data center. For the best results, this should be as near as possible to the majority of your target audience. This will minimize latency and ensure top-notch performance.
Finally, you’ll need to create a root password. This allows you to access your Droplet as the root user, allowing unrestricted access to all commands and files.
It is important that you set a secure root password. Do not use a simple, guessable password for the sake of memorizability. At the same time, make note of your chosen password now, as you will not receive a confirmation email containing your root password.
Once you’ve done this, you can hit Create Droplet.
Which Additional Options Should I Choose?
You’ll now be taken to the DigitalOcean dashboard. A project will be created automatically and your Droplet will be placed within it. DigitalOcean projects are purely for organization purposes – you can rename it if you wish, or just leave it as is for now.
It may take a minute or two for your Droplet to deploy – you can track this via a progress bar that will appear. Once the progress bar has filled, your new Droplet should be ready to configure. However, before we jump straight in, you may wish to take a look at the settings.
To do this, click the name of your Droplet on the dashboard homepage.
You’ll be taken to a screen with a long list of settings in a sidebar on the left. This area allows you to control and fine-tune many aspects of your server. You’ll also be able to add additional services that may further enhance your Droplet’s reliability, security, and performance.
It is a good idea to enable backups. This service offers an automatic weekly snapshot of your entire server. While you shouldn’t rely on this backup solution alone, it’s inexpensive and offers some protection against data loss.
If you’d like to enable this service, simply click Backups on the left, followed by the Enable Backups button. DigitalOcean will then display the date and time of your first scheduled backup. You’ll then be able to access your backups from this same menu once your site is up and running.
DigitalOcean also offers a variety of other optional features. You can enable additional metrics and configurable alerts for your Droplet for free, which allows you to track resource usage and overall traffic in greater detail. You may also wish to implement an IPv6 address, which offers greater security and more efficient routing.
Implementing these additional options isn’t effortless – you’ll have to use SSH and the command line.
While the guides DigitalOcean provides for implementing these features are quick and easy to follow, you may want to wait until you’ve completed the setup of WordPress and had some practice with an SSH client before jumping in.
Naming Your Droplet and Checking the Placeholder Page
While there’s nothing wrong with keeping the auto-generated name, you may wish to name your Droplet something that’s a bit easier to identify. To do this, click the current name of your Droplet at the top of its settings. Type in a new name, then click the blue checkmark to confirm.
You can name your Droplet whatever you like, but spaces, special characters, and most punctuation aren’t allowed. Hyphens are okay, though.
Now that your Droplet is all set up, you should test that it is functioning properly. To do this, you can visit its IP address. If all is well, the IP should return a DigitalOcean placeholder page.
Your Droplet’s IP address can be found in its settings or on the dashboard homepage. Mouse over the IP address to reveal a “Copy” command, which will speed things along. Then, you can simply paste this address into a web browser of your choice.
You’ll then be presented with this screen confirming the Droplet is properly configured and working. All you need to do now is set up WordPress!
While WordPress is installed on our Droplet, it’s not yet configured or ready to use. To finish setting up WordPress, you’ll need to use an SSH client to connect to your Droplet. Don’t worry, this isn’t as hard as it sounds. Follow my simple guide below to get it done fast.
What is an SSH Client and Which One Should I Use?
An SSH client allows you to remotely connect to a Linux machine (such as your Droplet) and control it via the command line. These clients commonly include simple graphical interfaces.
The most popular options are OpenSSH, which is built into Windows, and PuTTY, which is easy to use and free to download for both Windows and MacOS.
For this tutorial, I went with PuTTY. It offers a straightforward setup, and a simple UI that allows you to save your settings for repeated connections. It can handle mostly anything you can throw at it, and it suits our needs here very well.
While different SSH clients may have different setup processes, the commands you’ll be entering will be identical. If you choose a different client, you can skip past the PuTTY setup guide below.
How To Enable WordPress Configuration With the Command Line
To begin, you’ll need to install the PuTTY client. It can be downloaded for free on the official website. You should see a link to download the client right at the top of the homepage.
You’ll be taken to a screen with a list of downloads. As most computer users are on 64-bit Windows systems, you’ll likely want the top option. Download the appropriate installer and run it to complete installation of the PuTTY client.
Now, you’ll be able to open the PuTTY client for the first time. Before you start using it, you’ll need to configure it to work with your DigitalOcean Droplet. To start, enter the IP address of your Droplet at the top of the Session screen. You’ll also need to make sure your connection type is “SSH” and the port is set to “22”.
Once this is done, navigate to the “SSH” screen in the leftmost menu. Here, you’ll need to check you’re using the correct SSH protocol. “2” should already be selected, but if not, choose this option.
Next, set your login username as “root”. This saves you an extra step upon connecting to your Droplet. You can do this on the “Data” screen, found again in the main menu.
Finally, return to the “Session” screen. Here, you can save your settings for this session so that you do not have to re-enter them every time you want to reconnect to your Droplet. Give your session a name, then click Save. Your session will then appear in the list. If you wish to use these settings again later, click your saved session in the list and then hit Load.
Now, you’re finally ready to connect! Press the Open button at the bottom of the window to begin the connection.
Upon opening a connection to your Droplet for the first time, you will get a security warning. This appears whenever you open a connection to a new location, and will warn you to make certain that the server you are connecting to is safe. In this case, you can hit Accept to move on.
Now, you will be met with a command line window. You’ll be asked for a password – this will be the “root” password you set during the creation of your Droplet.
It’s worth noting that the characters you type will not appear in the command line – this is a security measure to ensure your password isn’t readable by any third parties. It may look like nothing is happening, but your inputs are working.
Once you’ve typed your password, hit the “Enter” key. If you’ve entered it successfully – congratulations! You’re now logged in to your Droplet as the root user. You’ll be welcomed to DigitalOcean’s One-Click WordPress Droplet, where you can begin configuring WordPress.
However, you’ll also need to connect a domain name to your Droplet. Let’s take care of this now. You can close the SSH connection for the time being.
Connecting a Domain Name
To go any further, you’ll need an active domain name. If you haven’t registered one yet, do so now.
I will be using a domain name registered with Hostinger, which offers lower prices than most for popular domain name extensions, along with easy DNS management. No matter which registrar you use, the process should be fairly similar.
First, log in to your domain registrar and locate your domain’s settings. If you’re using Hostinger, this can easily be found when you log in. Just click the Manage button next to the domain you’d like to use.
Find the nameservers section and click on the Change link to edit them.
These need to be changed to DigitalOcean’s nameservers, which are: ns1.digitialocean.com, ns2.digitialocean.com, and ns3.digitialocean.com. This will point your domain name to DigitalOcean’s servers.
If done correctly, your nameservers should look like the example in the above screenshot. Click Save to confirm the changes. Keep in mind that nameserver changes may take some time to fully resolve. While this can be instantaneous, it usually takes around an hour, and it can take up to a couple of days. I’d recommend waiting an hour or two before attempting the remaining steps.
Once you’ve allowed some time for the nameserver setting to change, you’ll need to configure your DNS. This needs to be done with DigitalOcean, not your domain registrar – as you’re using DigitalOcean’s nameservers, your DNS is now handled there.
Thankfully, DigitalOcean offers simple DNS management for domain names, even if they’re registered elsewhere.
Head back to your DigitalOcean dashboard. Click Networking in the leftmost menu, followed by Domains at the top. Here, you’ll need to enter your domain name without the “www.” – for example, I entered “awesomefool.com.” Then, click Add Domain.
Now, we’ll need to add a few DNS records. These connect your domain name with the IP address of your Droplet. The first record you will need to add is an “A” record. To do this, click the A option at the top of the screen.
In the Hostname field, you can simply enter the “@” symbol. This represents your root domain – your domain name and chosen extension, without any prefixes or subdomains. In my case, the root domain is “awesomefool.com.”
In the Will Direct To field, you can use the dropdown menu to select your Droplet. The “TTL” box can be left at its default value. Now, click the Create Record button. Your root domain will then point to your Droplet’s IP address, allowing visitors to use it to reach your site.
You’ll just need to add one more DNS record. Click the Cname option at the top. In the Hostname section, enter the “www.” prefix, then in the Is An Alias Of field, enter the “@” symbol. You can now click the Create Record button a final time.
This step just ensures that visitors who visit your domain with the “www.” prefix will be properly redirected to the correct IP address. Once this is done, you can safely head back to the homepage of the DigitalOcean dashboard.
Your DNS settings are complete! You should be able to see your domain on the dashboard homepage, complete with the added records. You may need to add more in the future if you wish to create a subdomain, IPv6 address, or a mail server, but for now, this will work just fine.
Completing the WordPress Configuration and Logging In to the Dashboard
Now that your domain and DNS settings are all in order, you can begin configuring your WordPress installation. Open an SSH connection to your Droplet with PuTTY, as you did earlier. If you saved your session previously, you can load the session’s profile.
Enter your root password to log in as the root user. You’ll then be asked to provide a domain name. Enter your domain without the “www.” prefix, and hit the Enter key .
You’ll then be required to set an email address, username, password, and website title. These details will be used to log in to the WordPress dashboard later, so be sure to keep a note of them. Fill out all of this information, then type “y” followed by the Enter key to confirm.
Next up, you’ll be asked whether you’d like to use Let’s Encrypt to configure SSL for your site. I highly recommend you add SSL now – it will offer a layer of security and credibility to your site at no cost. If you refuse, you’ll have to add SSL manually at a later date.
Type “Y” to accept, or “N” to refuse. If you accept, you’ll have to agree to Let’s Encrypt terms and conditions. You can do this by typing “A”.
If you’ve decided to add SSL, you’ll now be asked whether you’d like your email address to be shared with the Electronic Frontier Foundation, a partner of Let’s Encrypt. You can opt out of this, if you prefer, by typing “n”.
To finalize the SSL configuration, you’ll be asked which domain names you’d like to activate HTTPS for. You’ll likely see two options – one your root domain, and the other your domain name with the “www.” prefix.
You should leave the input blank and hit the Enter key. This will configure SSL for all options.
After some time, you should see that the WordPress installation process is finally complete! To confirm, you can type your domain name in a web browser – if it returns a basic WordPress site with the “Hello World” template text, you’re all good!
If you’re still seeing the placeholder page, don’t worry – these changes may take a short time to appear. It may help to clear your browser cache and cookies.
Setting Up Your Site
All that’s left is to begin building your site! To log in to your WordPress dashboard, simply enter your domain into the browser of your choice, but add “/wp-admin” at the end of the URL. For example, mine would be “www.awesomefool.com/wp-admin”.
This should take you straight to the WordPress login page. Enter the username and password you set during WordPress installation to proceed.
Congratulations! You should find yourself at the WordPress dashboard, where you can freely begin building pages, installing plugins, and so on.
You may notice that you already have a plugin installed – this is the WP fail2ban plugin, an effective defense against brute-force attacks which is automatically installed by the DigitalOcean WordPress installer. I would recommend installing further security plugins and backup solutions to better protect your site and data.
Anything Else I Should Know?
From here, you can build whatever site you desire – whether that be a blog, a landing page for your freelance work, or an ecommerce site.
Depending on your individual needs, you may wish to activate some of the additional options DigitalOcean has to offer, such as advanced metrics or an IPv6 address. Both require connecting to your Droplet through SSH, but DigitalOcean has extensive documentation to guide you through.
Don’t forget about proper WordPress maintenance – keep all plugins and themes up to date, along with your core software. Have some kind of robust backup solution active, as you don’t want to lose your data after all this hard work.
With all that done, I wish you and your WordPress site the best of luck!
What is a VPS?A VPS is a virtual server that offers you a dedicated portion of a server’s resources. DigitalOcean’s VPSs use cloud technology and are known as “Droplets.” DigitalOcean offers a top-quality platform, and as such, it’s relatively expensive – check out our list of the best web hosting services in 2022 for some cheaper alternatives.What is the price of a VPS from DigitalOcean?The use of a Droplet is charged by the hour. All costs incurred are collected into a monthly bill. The Basic Droplet offers more than enough resources for a simple WordPress site, and is reasonably easy to set up.Does DigitalOcean have a free trial?DigitalOcean offers a 60-day free trial with a $100 credit to try the service as you please. However, there’s no money-back guarantee. If you’re new to web hosting, you may want to have a look at our complete guide to launching your first website.Can I install WordPress with NGINX on DigitalOcean?While my tutorial is for a LAMP stack, it is possible to install WordPress with a LEMP stack if you’d prefer to use NGINX. However, many users of DigitalOcean have run into problems with this configuration. You may wish to try Cloudways, a managed hosting service with a free trial which offers easy installation of a LEMP stack onto a DigitalOcean Droplet.