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

September 13, 2021

13 Min Read
digitalocean wordpress

WordPress hosted on a DigitalOcean server is a great match because WordPress itself is one of the best CMSs out there and DigitalOcean provides an incredible cloud hosting solution. But insert Cloudways in the middle, 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?” And I’m going to highlight exactly that: 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 very technical. 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 also why 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 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

Yes, there are some cons to directly hosting your WordPress on DigitalOcean. So let’s take a look at both the pros and cons:

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.

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 services provider to do all the hard work for you.

Cloudways provides managed cloud hosting solutions and takes care of the server management for you. 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.


Cloudways offers a fully managed cloud hosting experience that ensures faster WordPress hosting on the cloud server. You can enjoy simple management for your cloud server while Cloudways manages the DigitalOcean server setup. As a result, you get to spend more time focusing on your business goals and process improvement.

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 and the process is really simple where will be required to verify your account by adding the credit card number.

Create and Launch DigitalOcean Droplet

After signing up for the account, the first thing you need to do is create a new droplet by clicking Create > Droplets.

create do droplet

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 where 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 nearest location to your target audience.

server location

Next, leave the VPC Network and Select additional options sections. Then, 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. I assume that you already have PuTTY. (or 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

Next, 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” (By default, there’s no root password).

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

 

Next, 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 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 check the configurations either it’s running or not. And, now 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, it means you’ve successfully installed the LEMP stack.

Install WordPress Application

Now, you will have to install your WordPress application on your DigitalOcean Droplet. So, let’s begin.

To install a WP application, all you need to do is 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

 

Now, 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!.

Now, 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.

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 to 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

Now it is time for you to select WordPress from the list of applications and then name your Application, 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

This is where you select DigitalOcean from the list of cloud hosting providers.

selecting digitalocean

Server Size

Now you need to select your Server Size based on your expected monthly traffic. Don’t worry about the frequent traffic spikes as 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

server 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 Monitoring

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.

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

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.

Security

server 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.

Application Management Dashboard

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

Domain Management

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.

 SSL Certificates

ssl management

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.

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 migration plugin

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.

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, we take care of that for you. Cloudways ensures a smooth web experience for the users. With tons of powerful features, enjoy our managed cloud computing services at affordable prices. The dedicated team of experts is available at your service 24/7. All you need to do is raise a ticket with our support system. With a strong knowledge base and up-to-date web applications, we will take care of your concerns within no time.

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

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!