Shared hosting services are a generation old now and especially for WordPress sites, cloud hosting is strongly recommended. WordPress is one of the most complete content management systems out in the market. There are many other content management systems that are focused on specific tasks like Ghost for blogging but WordPress has been under development for a long now and it has adapted itself for almost all kinds of usage now.
Shared hosting services are slow and less capable than any cloud hosting services available in the market. There are mainly three options that come to my mind when I think of cloud hosting for starters, they are Amazon AWS Lightsail, Vultr and DigitalOcean. All of them are insanely fast and capable of handling any web project including WordPress sites.
Table of Contents
Why Cloud Servers?
Well, there are many reasons for choosing DigitalOcean servers against cheap shared hosting services from GoDaddy, HostGator, Bluehost and many others. Some of the cons of shared hosting services are:
- Shared hosting is slow.
- No dedicated IP is available.
- You get a very small limit for visitors.
- You may suffer if someone on the same server drives excessive traffic.
- Slow sites rank low on SEO.
- You do not get full control over your server.
- You need to pay for a long(at least a year) time at one go.
There are no such limitations in any of the cloud services I mentioned above, be it DigitalOcean, AWS Lightsail or Vultr, you pay as you use the services and you need not pay if you are not using the services. This gives you the freedom of choosing any service you like and you are not bound to use a specific service even if you do not like it but because you have already paid for it. So the pay as you go, the model, is much more pocket friendly and efficient as well.
There is no strong reason behind choosing DigitalOcean for WordPress among the three cloud services I mentioned. It is your choice totally to go with either one of them. AWS Lightsail’s $5 instance actually performs slightly better than Vultr’s and DigitalOcean’s most basic $5 droplets, but the performance difference is very thin.
If you already have a site with good traffic, then I recommend you Vultr’s High-frequency VPS, it is quite efficient and performs very well. I will use DigitalOcean for this tutorial. If you want to try DigitalOcean, you can get a $100 credit for 60 days to try through this link.
You can read more about the difference between various kinds of hosting services and plans in our hosting guide.
Get Started with DigitalOcean
First of all, let us talk about the pre-requisites for owning a Virtual Private Server(VPS) on DigitalOcean. You must have:
- An active email ID.
- An eligible Credit/Debit card or an eligible PayPal account.
Here, by eligible we mean, the credit/debit card or the bank account linked with PayPal must have international transaction rights. In the procedure, it might deduct a small amount in order to verify the attempt, but the amount would be refunded within a few days, so in case of a debit card or PayPal you must have sufficient balance.
If you have these prerequisites ready with you, then you are ready to get started with DigitalOcean. So follow the steps below to set up your DigitalOcean account.
1. Head on to DigitalOcean and get a $100 Bonus Credit
Go to DigitalOcean through this link to receive a free credit of $100 for 60 days once you sign up. You can explore DigitalOcean totally using this free credit and then invest in it only if you like the service.
2. Sign Up with DigitalOcean and Register Your Credit Card
Now, sign up with DigitalOcean with a Google account, GitHub or any email id. Then you will need to enter your credit card credentials to make sure you are a genuine customer. A small amount will be deducted from your credit card but it will be refunded very soon as it is deducted for verification purposes.
If you are a student and you are trying your way into WordPress development or you want a personal website/blog be it for a hobby or some project, you can try to avail the $100 credit for 12 months through GitHub Student Developer Pack. You need to verify your identity as a student to get the coupon unlocked along with many more benefits, it’s worth checking.
3. Create Your First Project on DigitalOcean
Projects are similar to folders on your Desktop. They usually manage and store Apps and Droplets inside them. You can create a new project every time you work on something different.
For example, you can have a blog inside a project with its database, resources and all, similarly, you can have a different project for your e-commerce store. So projects differentiate your works for easy maintenance and improvements.
To create a new project:
- Click on the top left option saying ‘+ New Project‘.
- Enter the name of the project and a short description of it.
- Select the purpose of the project and create a new project.
Congrats! You have successfully created a new project in your DigitalOcean account and you have moved a step further.
4. Secure Your Account by Enabling the Two-Factor Authentication
You need to secure your account because no one wants a loophole in their work. DigitalOcean provides two-factor authentication and every time you log in, you will be asked for a one-time code which will be sent to your email or via SMS.
To enable the two-factor authentication for your DigitalOcean account, head to the ‘Settings‘ option from the left menu panel and simply click on ‘Enable 2FA‘ and then follow the prompts to enable the same.
Now, we have successfully set up our DigitalOcean account and a project as well. Now to launch a WordPress website, we need to install WordPress inside our project. So, let us have a look at how we can create a WordPress instance along with phpMyAdmin and a free SSL certificate.
Set Up a Droplet for WordPress in One-click
Virtual servers are named as droplets in DigitalOcean and we need to create a virtual server in which we will be installing and configuring WordPress. So you will need to follow the steps carefully and make sure you copy the codes carefully when required otherwise it will throw an error. You can also watch the video below to set up your droplet.
1. Create an WordPress Droplet
Enter the project you created just now and head to the top right and click on the green button saying ‘Create‘, then select ‘Droplets‘ from the dropdown.
2. Select WordPress from the Marketplace
Now, from the options under ‘Choose and image‘ head to the marketplace and select WordPress. Then, scroll and choose the ‘Basic Plan‘. We are choosing the most basic plan because we are just starting and we do not have much traffic. You can later scale your plans once your project starts growing.
3. Choose the Specs and Region
Once you select the ‘Basic plan‘, you will have many prices available. We are just starting out on our WordPress project so, we will just select the most basic one with 1GB RAM, 1 Shared CPU, 1000GB transfer and 25GB of SSD disk storage.
You may select the $6/month plans which offer newer CPUs from Intel and AMD. But my suggestion would be to go with Regular ones if you are doing it for learning purposes. If you have a production purpose and you want your site to have better load-handling capacity you may look upon Vultr’s High-Frequency plans which begin with $6/month plans, they are better according to my experience.
Next, we won’t be adding any block storage and we will skip to the datacentre region. Be careful while selecting the datacentre region and choose the datacentre region closest to your customers or viewers whom you are targeting through your website or web app. If you are targeting Indian readers then select the Bangalore datacentre region and if you are targeting the American readers select New York or San Francisco.
4. Additional Options
There are a few free options available in the DigitalOcean droplets like IPV6 routing, User data and Metrics collection. Let us understand what do we need and why.
IPV6 is a network-level protocol that allows data transfers and communications to take place over the network. It came up in 1998 to replace IPV4 someday. It is always good to enable IPV6 for our projects so we will be enabling IPV6.
User data allows us to run custom scripts while running the virtual server for the first time as a root user. It can be useful when you are planning to use cloud server managing applications like ServerPilot or something similar. We are not going to use any such scripts, so we will keep them disabled.
Next is the metrics collection feature, this is completely optional and if you want to look after the server resource usage pattern or the metrics of the server with alerts and notifications, then you can enable this option for free. We won’t be enabling this option too.
4. Set the Authentication, Size and Backup
Under the authentication tab, you have the option of using an SSH key or a password. SSH keys are more secure but we will be using a password this time. You can create an SSH key later as well, but if you want to use an SSH key, you can follow this tutorial.
For the time being, create a strong password and remember it. Now select the number of droplets (we will only create one droplet so skip it) and then name the droplet. You can name your droplet just like you name a folder on your desktop.
Skip the section asking for tags (because we do not have multiple projects to relate). Next, if you have multiple projects active in your DigitalOcean account then you are given the last option to choose the project under which you want to create the droplet. If you have only one project, then the option is greyed out and you need not worry about it.
Do not enable backups. Yes, you read it right. Do not enable backups until you have a large site to migrate to the droplet. We are just beginning so we won’t increase our expenditure and we will look into different free backup options inside WordPress. Now, click on ‘Create Droplet‘ to create the droplet. It will take about a minute to get your droplet ready.
Please note that this is a complete guide for setting up your WordPress workspace, so do not skip any step and do watch the videos if you have any doubt. It is highly recommended that you follow the steps systematically.
Install and Set Up the WordPress
Here is the complete video consisting of all steps under this topic. You can also watch the video below to get a complete and actual idea of the steps below.
1. Set Up Domain
First of all, if you need to set up a production site using WordPress, then you need to purchase a domain name for your site. A domain name is an address for your site or project on the internet. For example, when you write www.google.com you reach a page which is pointed by the domain www.google.com. The concept of the domain name is just to make it easier to remember site addresses. If it were not there then we had to remember some random numbers like 15.563.256.487, which would have been very difficult to remember.
Now, let us move to our main focus. You can purchase a domain from any domain registrar you like, be it GoDaddy Hostinger or Namecheap. The main task is to manage the domain. So there are a few steps you need to follow to configure your domain:
- Open the account in which you have your purchased domain name.
- Go to the DigitalOcean dashboard and open the project you created and then click on the three dots at the right extreme of the droplet and select ‘Add a domain‘.
- Enter your domain name and click on ‘Add Domain‘ to add your domain.
- Now from the details appearing, just copy the nameservers and add update the nameservers in the account from where you purchased your domain.
You can also watch the video given at the top to configure your domain properly. Here you can also see how to redirect the www version of your site to the non-www version with a single SSL installation.
Hey! Now your domain is has got associated with your WordPress droplet, but the installation is not yet complete. You can check if the DNS settings you made are updated or not in any DNS checker like this.
2. Install and Activate WordPress with SSL
So, you have successfully connected your domain to your WordPress droplet. Now we need to activate our WordPress installation. So to do this you need to follow a few simple steps as given below:
- Open Windows PowerShell if you are using Windows or you can use Putty as well, the commands will be the same for both the interfaces.
- In the PowerShell, enter the command given below and then enter the password you created while creating the droplet.
ssh [email protected]_droplet_ip
- Then it will ask you for the domain name you want to connect with the WordPress installation. So type the domain name you connected to the droplet just now. Be sure not to include http/s or www in the domain name just enter the domain name like example.com.
- Then enter your email id you want to connect your WordPress admin account with. It can be changed later as well.
- Then create a WordPress login username, password and then enter the Blog title means the name you want for the site you are creating, for example, OrbitGadget.
- Then follow the prompts and type ‘Y’ to proceed.
- Press ‘Y‘ to install SSL for your WordPress droplet and then enter your email address to get notified about the expiry and renewal of the SSL certificate on your site.
- Then follow the prompts and press ‘A‘ to agree to their terms of service.
- Select by number, whether you want your site to be the www version or non-www. It doesn’t have any effect on your SEO score. So choose any one and proceed.
- Now choose to redirect to the HTTPS version and enter the input after reading the prompt.
You can also watch the complete steps in the video above to get a complete idea about the process.
Now, you have successfully activated WordPress on DigitalOcean’s server. You can visit the site now to have a look at it, it may take about a minute to get reflected so relax (need not panic).
3. Install phpMyAdmin
We will also install phpMyAdmin on our droplet because it gives us visual control over the databases, and it becomes straightforward to migrate WordPress sites from one hosting service to another with phpMyAdmin. So I recommend installing phpMyAdmin and here are the commands to install the phpMyAdmin (paste these commands in the PowerShell you opened in the previous step)
sudo apt update sudo apt install phpmyadmin php-mbstring
Select Apache server when asked and create a strong password and remember it, it might be useful in future.
Try using different passwords for different purposes, it is good for security. There is a high chance that you might forget your passwords, so keep a safe record of all your passwords maybe in some safe notes or in a password manager.
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf sudo a2enconf phpmyadmin.conf systemctl reload apache2sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf sudo a2enconf phpmyadmin.conf systemctl reload apache2
Please watch the video, if you want a better idea about the sequence of the steps. It is always better to watch it happen and learn, you’ll get better ideas if something goes wrong afterwards.
4. Create a MySQL User for phpMyAdmin
Now, we will create a database user for phpMyAdmin to use. To create this simply paste the following code into the terminal and make sure you modify the terms ‘user‘ and ‘password ‘ to your desired username and password.
sudo mysql CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost'; FLUSH PRIVILEGES; exit
Now, you have just created a user for phpMyAdmin to access all the databases used in the droplet. You can now log in using the username and password you just created above at the phpMyAdmin panel, visit yoursite.com/phpmyadmin.
You should handle the databases carefully, mishandling can cause your site to go down. So I recommend it using very little because you won’t need it most of the time. You can also watch the video above to see it actually happening.
5. Secure phpMyAdmin
To give you a clear perspective of how you should secure your phpMyAdmin I recommend you to see the video above and then use the commands given below.
sudo nano /etc/apache2/conf-available/phpmyadmin.conf Alias /your_url /usr/share/phpmyadmin
In the above command replace ‘your_url’ with your desired text (more complex text makes it more secure). For example yoursite.com/verysecuresomething.
sudo service apache2 reload
So, finally, you have your WordPress site ready to work upon. You can now head to yoursite.com/wp-admin and login with the id and password you created in step 2 or activating WordPress, you will then enter into your site’s backend and you now have full control over the visibility, content and looks of your site.
Update Your Server
There are many more things you need to ensure to set up a good and healthy server. You need to keep it updated and restart the server if it requires a restart. You can use Canonical Livepatch Service from Ubuntu to ensure updates without server restart. Also, you can use the following commands to update your server from time to time.
sudo apt-get update sudo apt-get upgrade sudo apt dist-upgrade
The above commands help to update the components, packages and dependencies of your server. You can remove unnecessary things from your server by using the command:
sudo apt autoremove
Hope you liked this guide. You can also watch our tutorial on YouTube, we have a complete playlist on it. To know more about various Linux commands you can read our guide on various Linux commands and their uses.
If you liked this tutorial, make sure you share this guide with other geeks and subscribe to us on YouTube.