This article is the second part about using Digital Ocean Hosting to install your WordPress site, assuming that you have created and activated your account previously. If you have not yet activated your account, we advise you to check out: Part One about using Digital Ocean
Why use Digital Ocean with WordPress?
- Digital Ocean hosting has an easy-to-use control panel.
- DigitalOcean hosting supports WordPress built-in, which means you can install WordPress and create your own website quickly and easily with just a few clicks.
- Its price is reasonable, as Digital Ocean offers virtual servers known as Droplets that can be purchased starting at only $5 per month.
Note : A single droplet is the smallest unit of a cloud server. - With Digital Ocean, you can dynamically resize your virtual servers or clusters as needed.
Steps to install WordPress on Digital Ocean hosting
Important note before starting: The payment mechanism in Digital Ocean can be likened to the payment method in a prepaid phone. That is, you have to recharge your balance on the site first before you can create a Droplet server for your WordPress site.
Therefore, before you begin implementing the installation steps, you must create an account on the Digitalocean website and transfer the money to your bank account through which you registered on the site (you need at least $5 to start) and create your first project as we explained in the following article about creating an account for Digitalocean Hosting. .
Then you must follow the following main steps:
- Create a virtual server or droplet for your WordPress site within your project.
- Configure this droplet’s settings to enable access to the site via SSH.
- Installing WordPress on Droplet.
Below is a detailed explanation of each of these steps:
First: Create a droplet dedicated to WordPress in the Digital Ocean project
To create a new custom drop for your WordPress site follow these steps:
- Log in to the DigitalOcean control panel. You will automatically be taken to the Projects tab, which displays all of your projects that you have created in the control panel.
- Through this tab, you can create new projects by clicking on the +Create New Project button and specify the name of the project you want to create, its description, its purpose, and all other details, as we previously explained in the first guide.
- Select the project in which you want to create the droplet, then click the Create button at the top right of the window and choose from the drop-down list the first option Droplet to create the first droplet in your project as shown in the following image.
Then the next window dedicated to configuring the droplet will appear
The easiest way to configure this droplet to work with WordPress is by going directly to the Marketplace tab and choosing WordPress 5.8 on Ubuntu 20.04 . (This option means that DigitalOcean will install WordPress on Ubuntu 20.04 automatically)
Then choose the server resource plan that is appropriate for your site’s requirements. We will choose the cheapest default plan ($5 per month) because our site is here for testing purposes only.
Then select the data center location you want for the virtual server (Digital Ocean drops can be distributed across 8 different available data centers). Here, it is preferable to choose the location that is geographically closest to you.
Then you must select the VPC private network (leave it at the default position) and specify additional options for the server (here we will choose the last option, Monitoring).
Now, you must select a method to authenticate the virtual server. Here we will choose to authenticate it using the second option (password) since the site is experimental, as we mentioned. But of course, the SSh option is preferred and safer here if the site is actual.
After that, you can specify the number of drops allocated to the site (more than one drop can be allocated to the site). You can also specify a hostname for the drop so that you can remember it, and specify one or more specific tags or hashtags to distinguish it from other drops in the same project. Finally, you can change the project in which you will create the drop and choose another project from the drop-down list.
The last option that you must select is to enable the backup feature (this feature costs 20 percent of the drop price that you specified, which in our case is $1 per month). This step is necessary to enable you to restore your site in the event of any emergency.
With this, you have finished specifying all the options and settings required to create the drop. Click on the Create button to create your virtual server droplet.
Then the IP address of the drop will be displayed, through which you can move to the second step and install WordPress on this drop. Copy this IP and paste it into the browser address bar or click on the Get started link shown in the image.
When you navigate to the desired address, the browser will display to you a message (Please login to droplet via ssh to enable your WordPress installation). This message asks you to set up access to the server via SSH for the first time, and you can set it up as we will explain in detail in our next paragraph.
- You should also receive an email in the email address through which you registered with the Digital Ocean website containing your login information to the droplet via the SSH console. Keep this data because you will need it in the next step.
Second: Configure login settings to the SSH system
When you log in to the WordPress server by typing the IP address of your site in the browser, the following message will appear to you as we explained previously (please log into your droplet via ssh to enable your WordPress installation)
The reason this message appears is that the server or virtual machine (WordPress Droplet) that you created in the previous paragraph is not yet configured to be accessed through SSH.
So you need to log in to your DigitalOcean drop via SSH, configure it for the first time, and be able to access, control, and communicate with the drop via console.
You can do this process in several ways either using Putty in Windows or using Terminal in Mac. But in this guide, we will adopt the easiest method to log in to the drop via the SSH protocol, using the built-in console access in DigitalOcean, which enables this to be done easily from within the DigitalOcean control panel itself.
To do this, go back to the DigitalOcean control panel, go to the Projects tab, select the desired project, then select the desired droplet in the project (which you created in the previous step), then click on the three horizontal dots… appearing to the right of the droplet name. A drop-down list will appear, choose Access Console, as shown in the following image:
Now a command editor window dedicated to setup will appear. It asks you to enter the drop’s IP address, username, and password, which are the data that was previously sent to you via email. You can also create a new password for the root user account through this window.
Once you have completed entering the data correctly, you should see a message stating that WordPress has been activated on your droplet, as follows:
That’s it at this point. You are now ready to move on to the final step, which is installing WordPress on Droplet.
Third: Install WordPress on the Digital Ocean Droplet .
This is the final stage of preparing your WordPress site and is done by following the following steps:
1. Enter the droplet IP address again into your browser, and the familiar WordPress installation screen will now be displayed instead of the previous message. On this screen, select the language you want for your site. Here we will choose the Arabic language and then click on the Continue button to continue
2. Then specify the address you want for your site, the username, password, and email address of the site administrator. You can also deactivate search engine visibility if you are creating your site for the purpose of experimentation and testing, as in our case here.
note:
The database is pre-configured by Digital Ocean Hosting so you do not need to enter any database details here.
3. After entering all the required data, click the Install WordPress button and let Digital Ocean complete its work. It will only take a moment and you will see your WordPress site is ready to go!
4. After the installation process is completed, log in to your site’s control panel through the link IP /wp-admin
5. Your website control panel will be displayed as follows.
Thus, your site is now ready on the droplet, virtual machine, or virtual server that you created on Digital Ocean hosting, and you can start developing and reviewing it as usual.
Advanced settings for WordPress website in Qatrat Digital Ocean
Setting up the domain for the site and linking the domain name to the IP assigned to the drop.
So that you do not have to write the IP address of the site every time you want to access your site, you must link the domain name or domain of the site to the IP address that was prepared by the drop.
You can set up the URL of the WordPress website and link it to the droplet IP. You must follow two procedures as follows :
- Action 1: Add a Record A record pointing to the droplet’s IP address to your DNS.
- Second procedure: Change the URL in the Digital Ocean control panel
As you can see, the process has two parts that must be performed sequentially.
Part 1: Add a Record A record to your domain or DNS
The application of this part depends on the provider you obtained the domain from. You should look up how to do this step in your provider and get specific steps to do it.
If your domain provider supports the cPanel control panel, then log in to your cPanel account and locate the Zone Editor tool under the Domains section. You can also use cPanel’s search function to find it quickly
Click + Record A to add a Record A record in the DNS
Then add the domain name and address and click the Add an A Record button
Note: You have to add the domain twice here, once with www and once without. For example, if we assume that your domain name is example.com, for example, and you want to direct it to the IP of your new drop in Digital Ocean. In this case you need to add two Record A records in the DNS editor, the first is example.com and the second is www.example.com.
These two records will point the primary domain name to the IP address of the Droplet application.
Then you must use the following setting:
First record: example.com
Name is the domain name example.com. (Note here that the period . is included as a suffix)
Address is the actual domain address, i.e. the IP address of the droplet.
Second record: www.example.com
Name is the domain name www.example.com.
Address is the actual domain address, i.e. the IP address of the droplet.
This setting is also useful for websites that have different subdomains for their blogs. For example, blogging sites where the blog’s domain is as follows: blog.example.com
Once Record A is configured to point to your droplet’s IP address, it should take some time for the changes to be reflected on the site. This waiting period is called DNS propagation time and takes about 24 hours.
To verify that Record A is working, enter the URL (example.com) into your browser, and you should see your WordPress site on the Digital Ocean droplet. You have now successfully linked your domain to the DigitalOcean droplet you created.
Part 2: Change WordPress website URL in a DigitalOcean drop
When you install a WordPress site in DigitalOcean, the site URL is automatically configured as the server IP address. So you have to change it to the new domain name that you configured in the previous step.
Go to your WordPress control panel, then choose WordPress > Settings > General Settings.
Enter the site address in the WordPress Address (URL) text field, for example example.com.
And type the same address in the SiteAddress (URL) text field.
Once done, scroll down and hit the Save button to save the changes.
Set up an SSL certificate in your WordPress Droplet
Setting up an SSL certificate helps you enable the HTTPS protocol on your web server, which secures traffic between the server and clients connected to it. DigitalOcean provides a free tool for setting up SSL certificates by default on the WordPress droplet called Certbot.
To install and configure Certbot in DigitalOcean and add HTTPS to your WordPress site you will need a registered domain name and two DNS records:
- Record A from the domain (for example, example.com) to the server IP address
- Record A from the domain preceded by www (for example, www.example.com) to the server’s IP address.
This is done through the hosting control panel exactly as we explained in the first part of the DNS configuration section.
Once this step is completed, we will need to log into the Console droplet window via SSH and run the following command:
certbot –apache -d example.com -d www.example.com
Of course, after replacing example.com with your domain name.
There will be several prompts when you run this command. Agree by simply entering the letter Y in the console window.
You will also be asked if you want to redirect all HTTP traffic to the HTTPS version of the website. It is of course preferable to choose Yes, as this ensures that all your visitors will receive the encrypted version of your website.
Once you have completed this step, you will have to go back to your site’s WordPress dashboard and change the site URL from http to https.
Backup in DigitalOcean using SnapShooter
Digital Ocean offers backup service only once a week. But you can take backups of your site anytime you want. You can make manual backups of your site, of course, and you can also use custom services like SnapShooter that can be easily linked to DigitalOcean.
By using SnapShooter you can schedule and create as many backups as you need. Whether that’s every day, hourly or on-demand.
Conclusion
Digital Ocean is one of the best developer-friendly cloud hosting providers. It supports WordPress greatly and has an easy-to-use control panel. Therefore, it is an excellent option to start learning WordPress website development through it.
Leave a Reply