This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

How To Host WordPress on DigitalOcean

Updated on March 16, 2022

14 Min Read
wordpress on digitalocean

WordPress hosted on a DigitalOcean server is already a great match; WordPress is one of the best CMSes out there, and DigitalOcean is known for being industry-best as well. But add Cloudways to the mix, and a great match turns into a match made in heaven.

So you’re in the right direction when you ask “how to host WordPress on a DigitalOcean cloud server?” I’m going to highlight exactly that in this piece: how to install WordPress on a DigitalOcean Droplet (native DO),, and then how to install WordPress on a Cloudways managed DigitalOcean server.

Installing WordPress directly on a DigitalOcean Droplet is a very technical process. I will run various commands to install a LEMP (Linux, NGINX, MariaDB, PHP) stack and then a WordPress application. However, in the second method via Cloudways, you can instantly deploy your server and install a WordPress application in a few clicks.

Why DigitalOcean?

Before heading to the installation process, though, it would serve you well to know why DigitalOcean is such a good choice for your WordPress hosting needs, and how  Cloudways can enhance that experience.

If you are a blogger, designer, or someone with mission-critical hosting requirements, you can’t put your faith in cheap and/or unreliable web hosting providers. You need to make sure that your hard work doesn’t go to waste, and that you have the best cloud hosting for WordPress so you can grow limitlessly.

DigitalOcean is a cloud hosting provider headquartered in New York City with data centers across the globe. Its seamless connectivity allows users to deploy and scale multiple web applications simultaneously without any lag. DigitalOcean offers private virtual Linux OS-powered machines called ‘droplets.’

Pros & Cons of WordPress on DigitalOcean

As great as WordPress and DigitalOcean work together, whether you should directly host your WP site on DigitalOcean depends on your own requirements and technical prowess. Let’s take a look at the pros and cons of this:

Pros Cons
Affordable pricing Complicated installation
Easy to set up, well-documented FAQ and tutorials Pre-built server options only
User-friendly interface and management panel Security-related technicalities
Reliable connectivity
Multiple data center options
Dependable and consistent uptime

DigitalOcean is one of the fastest-growing cloud infrastructure providers because it is affordable and gives WordPress users a chance to exercise their development muscles. However, for an inexperienced individual who lacks technical expertise, managing a DO server can get a bit complicated.

Want to learn more about securing your WordPress website?

Learn how to manage the security of your WordPress website with the Cloudways webinar

Why Use DigitalOcean With Cloudways?

Cloud hosting is great but it also demands setting up, managing, and securing your cloud servers. It’s great if you know how to do it, but if you lack the technical expertise required to set up a cloud infrastructure for your website, you’ll have to hire a managed service provider to do all the hard work for you.

Cloudways offers a managed cloud hosting solution that takes care of server management and ensures faster WordPress hosting on the cloud server. It offers one-click WordPress installation and many other useful features. You can leverage the power of cloud hosting without needing to worry about the technicalities of server configuration and security.

A Brief Look at the Types of DigitalOcean Droplets

DigitalOcean offers numerous types of droplets that you can choose on the basis of your website’s needs. DO refers to virtual machines/cloud servers as droplets.

DigitalOcean offers five droplet plans and each has been designed for a specific purpose. So, before considering the best droplet for your WordPress site, it’s good to understand their purpose and primary function.

Following are the five Droplet types:

Basic Droplet

These droplets are specially designed for low to medium workload websites. Their primary purpose is to service blogs and CMSes at a lower cost. WordPress doesn’t require high server resources compared to other enterprise applications, so all you need is a performance-oriented stack on your basic DO droplet.

There are two versions of basic droplets, regular and premium, with slight differences in prices, performance, and the hardware technology. We have already covered in detail the performance benchmarks of the regular and premium droplet in our DO premium announcement post.

General Purpose Droplet

General Purpose droplets are referred to as balance (CPU and Memory) virtual machines that offer great computing power for standard workload applications like SaaS, medium-large scale companies, and more. These droplets are higher priced compared to the basic ones as they come with dedicated CPUs.

CPU Optimised Droplet

CPU optimized droplets are a good fit for high processing workloads like machine learning, CI/CD and video encoding. These servers provide high computing power through a greater number of CPUs with a low disk memory.

Memory Optimised Droplet

Unlike CPU optimized droplets, memory optimized machines are more focused on the server memory than the number of CPUs. These servers are a good fit for large data processing and big databases.

Storage Optimised Droplet

Storage optimized droplets uses the latest memory technology, SSD (NVMe) which is much more advanced than the regular SSD. These servers are ideal solutions for big database applications and data warehouses.

Cloudways offers basic DO droplets (Regular and Premium) on a managed cloud platform with a performance-oriented stack, several security firewalls, and more, to deliver a hassle-free WordPress hosting experience.

How to Install WordPress on a DigitalOcean Droplet

Here, I will deploy the LEMP stack and install WordPress on a native DigitalOcean cloud server. Therefore, first, you need to sign up and create an account on DO – it’s a simple process where you’ll be required to verify your account by adding the credit card number.

Create and Launch DigitalOcean Droplet

create do droplet

After signing up for the account, create a new droplet by clicking Create > Droplets.

On the Create Droplets setup screen, you can select and configure the server specs and other settings. The first section is the distribution selection. Choose an image. I will go with Debian 9. It’s the Linux OS flavor that you are going to install on your server.

choose an operating system

Next, choose a plan section, where I will go with Basic.

basic plan

Next in the process, choose the server specs for your DO droplet. For this tutorial, I’m selecting the lowest plan i.e. $5/month.

basic plan

Then just leave the Add block storage section and choose a data center region for your DO droplet. It is always recommended to choose the location nearest to your target audience.

server location

Next, leave the VPC Network and Select additional options sections. Click SSH keys under the Authentication section. If you already have an SSH key generated, you can choose that or else you need to create a new one.

Here, I’ll create a new SSH key and for that, you will be required to PuTTY. (If you don’t already have it, download it from download PuTTY).

Now, open PuTTYgen and click Generate to create an SSH key.

puttygen

Copy the whole text from the public key section and click Save private key to save your SSH key to your desktop.

save generated private key

Next, get back to your DO server setup and click New SSH Key. After that, paste the copied text to the SSH key content section, give it a name (I opted for Cloudways), and click Add SSH Key.

add ssh key

Next, choose a hostname for your droplet. I’m naming it FarhanWordPress.

host name

Now, leave all the sections because the server setup is completed and all you need to do is Create Droplet.

click create droplet

It will take a few minutes to create your new droplet.

Deploy the LEMP STACK

To deploy the LEMP stack, first, you need to open PuTTY and paste your server IP.

server ip

Next, navigate to Connection > SSH > Auth, click browse and select the PPK file that you have recently downloaded from PuTTYgen.

ssh auth

Click Open to access your newly created DO server and type root.

root

Run the following command to install the LEMP stack.

cd ..

Change directory.

change directory

apt update

Update the package lists.

package update

apt install nginx

To install the NGINX web server.

install nginx

apt install mariadb-server

To install the MariaDB database.

install mariadb

mysql_secure_installation

To secure your MariaDB installation

Note: At first, it will ask for the root password and you just have to press “Enter” (there’s no root password by default.)

If you want to set the root password for your database, press “y” and simply update it.

db root password

apt install php-fpm php-mysql

To install PHP FPM and MySQL.

install php packages

nano /etc/nginx/sites-available/default

To edit the default file.

Then add index.php to that line as we are using PHP.

edit default file

Uncomment the four lines by removing “#” as shown in the following image and save the file by pressing “ctrl + x”.

uncomment some lines

nano /etc/php/7.0/fpm/php.ini

To edit the php.ini file.

edit php ini file

Then, press “ctrl+w” and paste “cgi.fix_pathinfo=” with a right click.

search for a text in file

Then, uncomment that line (by removing “;”) and set value “0” like this: cgi.fix_pathinfo= 0;

uncomment line and set cgi value 0

Then, exit by pressing ”ctrl+x” and save the changes you’ve made.

Now it’s time to whether check the configuration is running or not. I will create a PHP file and name it farhan.php.

nano /var/www/html/farhan.php

php file

Paste the following code into the PHP file and save the changes.

  1. <?php
    
    for ($count=1; $count<=9; $count++)
    
    {
    
       echo " $count times 9 is ". $count*9;
    
       echo "<br>";
    
    }
    
    ?>

    php code

Before running the newly created PHP file in the browser, you need to restart NGINX by using the following commands.

systemctl restart nginx

restart nginx

After running the above script, check the PHP file in the browser “http://yourIPaddress/farhan.php”.

running php file

If the newly created PHP file starts executing, you’ve successfully installed the LEMP stack.

Install WordPress Application

Now, you will have to install your WordPress application on your DigitalOcean Droplet. To install a WP application, just run the below commands.

apt install php7.0-common php7.0-mbstring php7.0-xmlrpc php7.0-soap php7.0-gd php7.0-xml php7.0-intl php7.0-ldap php7.0-zip php7.0-curl

To install important PHP modules and packages:

installing php modules

mysql -u root -p

To access the DB root, run the above command, and use the password that we have previously set up during the MariaDB installation.

root db

CREATE DATABASE CWdb;

Create a new database.

create a new database

GRANT ALL PRIVILEGES on CWdb.* TO 'farhanuser'@'localhost' IDENTIFIED BY 'password123';

Grants full control and permission to a user.

grant privileges

FLUSH PRIVILEGES;

Changes to take effect without restarting the DB service.

flush privileges

Then run the exit command.

exit command

cd /var/www/html/

After that, change the directory to html folder.

change directory to html folder

wget https://wordpress.org/latest.tar.gz

Download the latest WordPress version.

install wordpress

tar xzvf latest.tar.gz

Extract the archive file.

extract archive

chown -R www-data:www-data /var/www/html/wordpress/

Assign ownership.

assign ownership

chmod 755 -R /var/www/html/wordpress/

Set file permission.

set file permission

systemctl restart nginx

Restart NGINX.

restart nginx

Open the WordPress file( essentially the WordPress website) in the browser “http://yourIPaddress/wordpress”.

select language

Choose the language and continue the installation process.

click lets go

You will require some information on the database. So, click Let’s go!.

Change the value of the Database Name, Username, and Password (that we have previously created) and click Submit to connect the database with the WP application.

set database values

Finally, run the installation.

run wordpress installation

After running the installation, you will see the basic WordPress setup screen where you need to enter the information about the website you are creating.

added wordpress information

Click Install WordPress and login to the WordPress dashboard.

Install WordPress on Cloudways Managed DigitalOcean Server

The prerequisite of this process is that you need to sign up with Cloudways by completing a simple form and clicking the Start Free button. If you have already signed up, feel free log in to your account.

cloudways signup

The next step in installing WordPress on DigitalOcean is to verify your email address in order to complete the signup process on Cloudways. After verifying your email address, click the Launch button and initiate the simple server launch process.

server launch

Server and Application Details

Application

Select WordPress from the list of applications and name your Application and Server, and Select Your Project.

application and server details

Note: You have the choice of launching Cloudways Optimized WordPress, WordPress with WooCommerce, WordPress Multisite, and WordPress without any optimization. Feel free to select what best suits your needs.

Cloud Infrastructure

Select DigitalOcean from the list of cloud hosting providers.

selecting digitalocean

Server Size

Select your Server Size based on your expected monthly traffic. Don’t worry about frequent traffic spikes; you can always scale your server using a simple slider.

digitalocean server

Server Location

Now select your desired Location keeping the latency factor in mind.

server location

After entering the Server and Application details, click the Launch Now button.

launch now

Now, wait for a few minutes until the server is ready!

Once the server is ready, click Applications in the top-left menu.

application section

Click your WordPress application.

wordpress application

Go to Access Details → Admin Panel. You will see the default login credentials and the temporary staging URL of the WordPress website. Click the URL and use the credentials to log in to the WordPress Dashboard.

website access details

Great! We have successfully installed WordPress on the DigitalOcean server using Cloudways.

Exploring the Cloudways Platform

Server Management Dashboard

After installing WordPress on DigitalOcean, head over to Server Management. Although it is easy to navigate through the Cloudways platform, I will still give you a hint of some of its highlighted features.

Inside the Server Management dashboard, you can find some useful tabs:

Master Credentials

This tab contains your server’s public IP, username, and password. On the left side of the window, you have the option of creating public SSH keys for SSH and SFTP connections, and a button to launch an integrated SSH terminal.

server master credentials

Server Monitoring

Here, you can monitor the resources of your server. This is further broken down into Summary and Details for graphical representation and third-party application monitoring tool New Relic.

server monitoring

This gives real-time data of your server health and shows useful stats like disk space, memory, and bandwidth over the course of time.

Manage Services

The Manage Services tab lets you enable and disable various services such as Apache and NGINX web servers, Memcached, Nginx, and Varnish. It also shows the current status of each service and lets you restart it when needed.

manage services

Security

The Security tab lets you whitelist the IP addresses you want to allow SFTP/SSH connections to. The second tab is dedicated to MySQL connections as Cloudways let its users remotely access the MySQL database.

server security

Application Management Dashboard

Just like Server Management, the Application Management dashboard also contains useful tabs. Let’s look at some of them.

Domain Management

As the name suggests, this tab allows Cloudways users to point their primary domain to their WordPress site. The additional domains can also be added in the case of a WordPress Multisite.

domain management

 SSL Certificates

Having an SSL certificate on a WordPress site is important as it secures the connection between the browser and the server. SSL encrypts this communication and prevents possible data theft. Cloudways prioritizes security, therefore, it provides Free SSL via Let’s Encrypt to its customers.

ssl management

This certificate can easily be added from this tab and in the case of sub-domains, users can also use the wildcard feature which allows them to use the same certificate on all their sub-domains.

Migration Tools

Cloudways customers who wish to bring their existing site from their old server to a fast and reliable Cloudways DigitalOcean server can use this tab for hassle-free cloud migrations.

cloudways migration plugin

Taking the Website Live

Taking your new WordPress site live is as easy as launching a server on Cloudways. All you need to do is to head over to your Application Management dashboard and inside the Domain Management tab, add your domain name.

take website live

According to your domain registrar, create a new CNAME and wait for it to get propagated.

And that’s all folks. Congratulations! You have successfully installed WordPress on the DigitalOcean cloud server on Cloudways. If you need to understand what Cloudways has to offer, here is a walk-through for a better understanding.

Also, here is a short video that shows how easy it is to host a WordPress website on DigitalOcean cloud server with the assistance of Cloudways.

Wrapping Up!

DigitalOcean is changing the face of cloud hosting – one droplet at a time. It is one of the best cloud hosting providers for WordPress websites. Its developer-friendly cloud infrastructure provides everything you need to scale your website with ease. With extensive documentation comprising a dedicated page for WordPress, you will enjoy an intuitive design, user-centric guides, and robust features.

As far as technicalities are concerned, Cloudways ensures a smooth web experience for the users, with tons of powerful features. There’s also a dedicated team of experts available for support  24/7.

I hope that you now know how to host WordPress on DigitalOcean. If you still have any queries, feel free to ask me via the comment section below.

Frequently Asked Questions

Q: Is DigitalOcean good for WordPress hosting?

Yes, DigitalOcean is, in fact, one of the best WordPress cloud hosting providers, thanks to its developer-friendliness and easy scalability, among many other features.

Q: How much does it cost to host WordPress on DigitalOcean?

You can host WordPress on DigitalOcean for as low as $10/month on Cloudways, which offers 1GB RAM, 1TB Bandwidth, 1 Core Processor, and 25GB Storage. Moreover, you can upgrade your plan to get added benefits and get FREE Object Cache Pro worth $95 on all DigitalOcean plans on Cloudways that offer 2GB RAM or above.

Q: What is DigitalOcean Good for?

DigitalOcean is a developer-friendly cloud hosting provider that helps the developers monitor and manage their droplets and do easy scaling via DigitalOcean application deployment without affecting the performance.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Customer Review at

“Beautifully optimized hosting for WordPress and Magento”

Arda Burak [Agency Owner]

Farhan Ayub

Farhan is a community manager at Cloudways. He loves to work with WordPress and has a passion for web development. Mostly, he spends his time interacting with the people in the WordPress community. Apart from his work life, Farhan spends his time gaming and playing sports. Feel free to contact him at [email protected]

×

Get Our Newsletter
Be the first to get the latest updates and tutorials.

Thankyou for Subscribing Us!

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!