Launch WordPress (WP) sites on DigitalOcean (DO) in less than 10 minutes.

Newbie bloggers or site owners often ask how to make the site load faster on shared hosting, and they know the limitation. And after going through a few frustrations moments, they want to move out from shared to cloud hosting.

One of the first cloud hosting platforms that comes in mind is DigitalOcean.

DO is excellent to get it started; its cheaper than AWS and GCP, scalable, fast, and offers all the features you can expect.

But, setting up a site is challenging if you are not familiar with system administration tasks. DO give you the OS and everything you need to take care of yourself.

After receiving many questions through email about how to set up the WP site on DO, I thought to put together a procedure for a broader audience to get benefited.

Before getting into technical implementation, please note – DO is not a domain registrar. Which means you can’t buy a domain from them. I assume you already have a domain, and if you don’t and want to get a new one, then buy from Namecheap.

Let’s get it started…

There are multiple ways to set up WordPress, but one of the easiest ways I’ve found is by using EasyEngine. In this tutorial, we will use EasyEngine to install all the necessary software and create a WP site.

Getting a DigitalOcean Server

DO has data centers in multiple locations globally. Choose closer to your audience.

  • Login (Sign Up if you don’t have an account yet) into DigitalOcean
  • Create new droplet and choose Ubuntu 18.x as OS
  • Choose a droplet plan based on the requirement, but if you are starting by then 2GB or 3GB RAM should be ok
  • Choose to monitor as an additional option
  • Give hostname and click create

It will take around one minute, and you should see the newly created server listed there.

DO would send the server credential to your registered email.

  • Log in to the server with the given credential and IP using the SSH client

When you log in for the first time, it will prompt you to change the password. That is expected and recommended to change to a complex password.

Installing EasyEngine

Once the server is ready, its time to get EasyEngine (EE) installed. EE is a great automation script that helps you to create multiple types of sites with a simple command. The good thing about EE is that you don’t have to worry about setting up individual components like Nginx, MariaDB, Redis, PHP, etc. Everything is taken care of in the background, and it is completely FREE!

easyengine

The latest version of EE leverage Docker but again, you don’t need to know about them. EE is production-ready and loved by thousands of heavy-traffic sites.

Let me show you how easy it is to use EasyEngine. I assume you are still logged into a DigitalOcean server.

  • Let’s update by executing below command
apt-get update
  • And, install the EE with the following command
wget -qO ee rt.cx/ee4 && sudo bash ee

It will take a few minutes to install the necessary software in the background and once done, and it will take you to the prompt.

Status: Downloaded newer image for easyengine/redis:v4.0.0
+-------------------+----------------------------------------------------------------------------+
| OS                | Linux 4.15.0-45-generic #48-Ubuntu SMP Tue Jan 29 16:28:13 UTC 2019 x86_64 |
| Shell             | /bin/bash                                                                  |
| PHP binary        | /usr/bin/php7.2                                                            |
| PHP version       | 7.2.15-1+ubuntu18.04.1+deb.sury.org+1                                      |
| php.ini used      | /etc/php/7.2/cli/php.ini                                                   |
| EE root dir       | phar://ee.phar                                                             |
| EE vendor dir     | phar://ee.phar/vendor                                                      |
| EE phar path      | /root                                                                      |
| EE packages dir   |                                                                            |
| EE global config  |                                                                            |
| EE project config |                                                                            |
| EE version        | 4.0.10                                                                     |
+-------------------+----------------------------------------------------------------------------+
-----> Run "ee help site" for more information on how to create a site.
[email protected]:~#

This concludes EasyEngine is installed and ready to use.

Creating a WordPress Site

EE has an option to create a WordPress site with Redis cache, which performs better. I use Redis on Geekflare and happy with it, so I would recommend trying that.

Let’s create a WP site on a domain with Redis cache.

ee site create geekflarelab.com --type=wp --cache

Above, I am using ee command to create a site with domain name geekflarelab.com and type as WordPress with caching option.

It will take a few seconds, and you should see a successful message like the following.

Configuring project.
Creating WordPress site geekflarelab.com
Copying configuration files.
Starting site's services.
Downloading and configuring WordPress.
Moved /var/www/htdocs/wp-config.php to /var/www/wp-config.php successfully
Success: Host entry successfully added.
Checking and verifying site-up status. This may take some time.

Installing WordPress site.
Success: http://geekflarelab.com has been created successfully!
Site entry created.
Creating cron entry
Success: Cron created successfully
+--------------------+----------------------------------------+
| Site               | http://geekflarelab.com                |
+--------------------+----------------------------------------+
| Site Root          | /opt/easyengine/sites/geekflarelab.com |
+--------------------+----------------------------------------+
| Site Title         | geekflarelab.com                       |
+--------------------+----------------------------------------+
| WordPress Username | inspiring-galois                       |
+--------------------+----------------------------------------+
| WordPress Password | xxxxxxxxxxxx                           |
+--------------------+----------------------------------------+
| DB Host            | global-db                              |
+--------------------+----------------------------------------+
| DB Name            | geekflarelab_com                       |
+--------------------+----------------------------------------+
| DB User            | geekflarelab.com-DRf3pP                |
+--------------------+----------------------------------------+
| DB Password        | xxxxxxxxxxxx                           |
+--------------------+----------------------------------------+
| E-Mail             | [email protected]                 |
+--------------------+----------------------------------------+
| SSL                | Not Enabled                            |
+--------------------+----------------------------------------+
| Cache              | Enabled                                |
+--------------------+----------------------------------------+
[email protected]:~#

Great, so my WP site is created. EasyEngine takes care of Nginx, database, PHP optimization, so you don’t have to perform any changes

Its time to test it.

Do you think it will work when I hit geekflarelab.com?

No!

I got to update A record of a domain to point to DigitalOcean server IP.

  • Log in to the domain registrar console and update the A record.

Now, I can access geekflarelab.com

You see, in just a few minutes, I have WP running on DO cloud server.

I would also prefer doing the following.

Changing SSH Port

By default, SSH port is 22, and everyone knows. This helps an attacker to perform a brute force attack, and if the server password is weak, then your server might get hacked. Changing the default port to something else would be a quick win.

I’ve explained how to change the SSH port in the below article.

How to Secure and Harden Cloud VM (Ubuntu & CentOS)?

Implementing SSL/TLS Certificate

It is mandatory to have your site over HTTPS, and the good thing about is you can get it free. If you don’t want to get into lengthy technical implementation, then I would recommend trying Cloudflare.

Cloudflare offers FREE SSL, along with other performance and security advantages.

Securing WordPress

Don’t leave WordPress un-secure.

There are multiple plugins available, but if budget allows, then go for a premium solution. You can choose to either go with the Cloudflare PRO plan or SUCURI. Both offer comprehensive performance and security features, including FREE SSL cert, DDoS attack prevention, OWASP top 10 vulnerabilities mitigation, etc..

How fast is the DigitalOcean WP site?

Well, it is difficult to generalize this as every site is unique. But, just to give you an idea, I did some load tests, and here is the result.

I installed the Authority Pro theme by StudioPress and put some dummy posts to test using Blazemeter.

Pretty amazing. Isn’t it?

As you can see, the test was done with 50 users for 5 minutes from North California, and the result is terrific.

  • Average response time – 351.19ms
  • Error – 0%

Anything less than 1 second is impressive.

Conclusion

If you are on shared hosting and looking to move out to the cloud and ready to spend time setting up, then DigitalOcean would be a good choice. However, if you don’t have time and skills in managing yourself, then I would recommend taking a look at Kinsta.

Kinsta is a premium managed WP hosting platform that leverages the Google Cloud Platform to offer the best performance and security.