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 which are focused on specific tasks like Ghost for blogging but WordPress has been under development for 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 projects including WordPress sites.
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 long (at least a year) at a time.
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, model, is much more pocket friendly and efficient as well.
Now, among the three cloud services I mentioned, there is no strong reason behind choosing DigitalOcean for WordPress. It is your choice totally to go with either one of them. AWS Lightsail actually performs slightly better than Vultr’s and DigitalOcean’s most basic $5 droplets, but the performance difference is negligible.
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.
- A Credit card or an eligible PayPal account.
If you have these 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
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 on it only if you like the service.
2. Sign Up with DigitalOcean and Register Your Credit Card
Now, sign up with DigitalOcean with Google account, GitHub or email. 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 purpose.
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 loop hole in their work. DigitalOcean provides two-factor authentication and every time you login, you will be asked for an one-time code which will be sent into 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 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 pricings 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.
Next, we won’t be adding any block storage and we will skip to 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 some day. 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 it 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 an option of using an SSH key or a password. SSH keys are more secure but we will be using password this time. You can create SSH key later as well, but if you want to use 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 a 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 not proceed yourself if you do not understand each step you are taking on your own. 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 127.0.0.1, 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 www version of your site to 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 here.
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 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 anyone 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 to panic).
3. Install phpMyAdmin
We will also install phpMyAdmin on our droplet because it gives us a 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.
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
systemctl reload apache2
You can also watch the video, if you want a better idea of the steps.
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.
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'user'@'localhost';
Now, you have just created a user for phpMyAdmin to access all the database used in the droplet. You can now login 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 less 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).
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.
Hope you liked this guide. You can also watch our tutorial on YouTube if you want to know how I designed a WordPress blog from scratch in just 10 minutes.