DigitalOcean WordPress

Hosting WordPress on a DigitalOcean Droplet

4 min read

WordPress is “open source software you can use to create a beautiful website, blog, or app.” I have created a few websites with it throughout the past 10 years as it is easy to customize and has excellent support from the community.

When it comes to hosting WordPress, there are a lot of options available.

  • WordPress
  • GoDaddy, HostGator, etc.
  • AWS, Azure, DO (DigitalOcean), etc.

And each option has their own pros/cons around areas such as:

  • Cost
  • Ease of setup & maintenance
  • Security and backups
  • Options for customizing (CSS, plugins, etc.)

Hosting with WordPress is the cheapest option at $4/month for their Personal plan, but with limited functionality – no plugins or customizing CSS. Next up are the shared hosting providers (GoDaddy, etc.) and lastly one of the cloud vendors (AWS, etc.). The latter two provide the most flexibility when it comes to customization.

Paying up front can also decrease what you pay and you’ll benefit from economies of scale. Your needs and technical skills should determine which hosting option you choose. For this post, we will be exploring hosting with DO which can be done for as little as $5/month.

DO provides a droplet in the marketplace that comes preloaded with all the software (Apache, MySQL, PHP, etc.) required to run a self-contained WordPress instance. The droplet also ships with some extra security configuration and boasts an easy to use CLI tool to help complete your WordPress setup.

If you want to follow along, you will need the following:

  • Domain with DNS pointed to DO’s nameservers
  • DO account
  • PuTTY (if you want to generate SSH keys)

Create a Droplet

Login to your DO account and create a droplet.

Select Marketplace under Choose an image. Select WordPress on 18.04. This image will come preloaded with all dependencies to run WordPress.

Choose the Starter – Standard plan and the $5/mo plan. Depending on your estimated traffic, you may want to select a Performance – General Purpose plan with more memory/compute capacity & transfer.

Choose a datacenter region nearest to you or your target audience. This will help reduce any latency for your end users. I’ll be using NY as I live in SC.

Choose SSH keys for authentication. If you do not have a SSH key pair already, you can follow the 2 steps below to create one.

Run ssh-keygen on your machine.

Copy and paste the contents of your *.pub key into the SSH key content box.

Add a wordpress tag to the droplet. This can be used later for applying firewall rules. I would also suggest enabling backups. It is relatively cheap at $1/mo for this droplet. Click Create Droplet.

After your droplet is created you will be able to see it under Resources for your project. Go ahead and copy the public IP. If you navigate to that IP in a browser, you will see a landing page indicating that WordPress is not configured yet.

Configure WordPress

SSH into the droplet using ssh root@ip.address.

Provide your domain name, email address, username, password & blog title when prompted.

Choose yes when prompted about configuring SSL. Provide an email where you’d like to receive notifications about renewal/security. When prompted about names you want to activate HTTPS for, leave the input blank for all options.

Ignore the Failed authorization procedure error. That will be resolved when the DNS is properly configured.

Update DNS

Add your domain name in the Network section.

Add the following two DNS records:

A@select droplet in dropdown

Once the DNS propagation is complete, we can finish configuring SSL. In your SSH window type certbot --apache -d -d – make sure you replace with your domain names!

If everything was successful, you will see messages similar to below.

Create a Firewall

Create a new firewall in the Network section. Add HTTP & HTTPS types in the Inbound Rules section in addition to SSH.

Accept the following outbound rules. Add the wordpress tag under Apply to Droplets and click Create Firewall.

Now you can open your domain in a browser and validate your WordPress installation and SSL certificate.