The most important part of my online business are my websites, like the one you are reading right now. For years, I hosted all my websites at Siteground, and everything was great. However, a few weeks ago, a problem appeared on my cloud hosting account at Siteground, and their team was unable to fix it. Worst than that, all my sites went down for a whole weekend, and the only solution they had was to pay more and more (I was already paying $80 a month!). Therefore, I recently decided to move all my WordPress sites on my own cloud server at Digital Ocean, where all my web apps are already running.

In this article, I will show you how you can get your own cloud hosting for your WordPress sites, for less than $5 a month. We’ll start by creating a droplet on Digital Ocean, installing Docker, and then running WordPress and all the additional components that are required. Let’s start!

Creating the Droplet

The first step is to create an account at Digital Ocean in case you don’t have one already. Then, create a new droplet. You can choose the smallest size possible for the droplet, and also the latest version of Ubuntu:


Then, make sure to check the box with your SSH key (you can find great tutorials on Digital Ocean on how to create a SSH key and link it to your account). Also give a name to your droplet before creating it:


You should now see your newly created droplet inside the Digital Ocean interface. You should also see the IP address of the droplet: copy it, you’ll need it in a moment. Now, go to a terminal on your computer, and type:

ssh [email protected]_address

Of course, change the IP address by the one you got from the Digital Ocean interface. You now have your own cloud server already, and we are ready to install WordPress on it!

Installing Docker

Now that you are logged into your droplet, we are going to install Docker. There are many ways to run WordPress on a server of course, but Docker will allow you to have a modular approach to the configuration of your server, and allow you to easily have several WordPress sites on the same server. First, add the following key to your droplet with:

sudo apt-key adv –keyserver hkp:// –recv-keys 58118E89F3A912897C070ADBF76221572C52609D

Then, add the Docker official repository to your droplet using the following command:

echo “deb ubuntu-xenial main” | sudo tee /etc/apt/sources.list.d/docker.list

After that, update the list of available repositories with:

sudo apt-get update

You can finally install Docker with the following command:

sudo apt-get install -y docker-engine

Docker should now be installed and running already. You can check the status of Docker by typing:

sudo systemctl status docker

Running WordPress on Your Cloud Server

At this point, you could already use Docker directly to run WordPress. However, as we’ll need several additional components like a database, I prefer to use another software called Docker Compose that will allow you to define your whole server architecture inside a script. It will then be really easy for you to extend to more WordPress sites.

First, install Docker Compose with:

sudo apt-get install docker-compose

Then, create a configuration file for Docker Compose using:

touch docker-compose.yml 

After that, open the file with:

nano docker-compose.yml

We are now going to see exactly what we will put inside the file.  We’ll basically define a block for each Docker container we want to run. The first one will be for the WordPress site itself:

  image: wordpress
     - wpdb:mysql
     - ~/wordpress/somesite:/var/www/html
    - 80
    WORDPRESS_DB_NAME: website

Here, you need to define the name of your site, it’s URL (you can use the IP address of the server if you don’t have a domain name yet), and also the password of the database. Note that we also link it to another container, which is the database.

Then, we need to of course define the container for the database. This is done by the following code:

  image: mysql

Again, you need to put the same password for the database that you put in the WordPress container.

After that, we create a container for phpmyadmin, that we’ll use to access the database directly. This is not mandatory, but it can really help in case you need to access the database directly. This is the code for that:

  image: phpmyadmin/phpmyadmin
    - wpdb:mysql
    - 3100:80
    PMA_HOST: mysql

Finally, we’ll need a container called nginx-proxy, which will basically direct the visitors to the correct WordPress site in case you have several sites on the server. This is the code for that:

  image: jwilder/nginx-proxy
    - 80:80
    - /var/run/docker.sock:/tmp/docker.sock

You can now put it all inside the file. This is the example with the WordPress site I used for this article:


Of course, if you need more than one WordPress site, simply copy the WordPress container and create as many of those containers as you want. Then, start all the containers with:

docker-compose up -d

This will download all the required files and start the containers. Once that’s done, make sure the containers are running with:

docker ps

We can now finally test our installation! Just enter the domain name of the WordPress site you want to test (or the IP address of the server), and you should be greeted by the usual WordPress install page:


Congratulations! You now have your own cloud hosting server for your WordPress sites. Using Docker, you now have a modular way to add more sites to your server, without having to configure a lot of parameters by hand. Of course, if you need many additional sites or you expect a lot of traffic, you will need to upgrade your droplet to handle that. I am currently currently using a $20 per month Digital Ocean droplet for all my sites and for more than 100k visitors per month. This is still way cheaper than other solutions, and it will allow you to completely control how you manage your server.

I hope that this article will help you to run your WordPress sites on your own cloud server, and if you have any questions or comments don’t hesitate to leave them below!