TECHNOPHILE

How I moved my WordPress blog from $12/month aws cloud to $15/year namecheap hosting with Free SSL by Let’s Encrypt

I have been using Free Amazon EC2 instance provided by AWS for hosting. AWS provides free t2.micro EC2 instance for the first year if you signup and and add a payment information. You can use this link for more details on the Free Tier provided by Amazon. After the first year I was started to receive monthly bills around 700 INR which is around $12. It isn’t big money if you compare the services offered by Amazon. But I wasn’t earning much from my blog so I couldn’t afford it.

So later I started to research about reliable hosting providers with cheap monthly charge. Tracking my search history, Facebook once suggested my the advertisement of Namecheap EasyWP hosting plan which is exclusively tailored for WordPress users. I had a look into the plan and was impressed with the pricing for the services they provide. For someone who is managing a personal WordPress blog, this is a great hosting plan. But I wanted a little more, say SSH access. Because I wanted to configure free Lets Encrypt SSL/TLS certificate for my blog. So that I could save some money by not paying for it.

But unfortunately this plan didn’t come with SSH access since there is no dedicated server for the subscriber. Then I started looking at their shared hosting plans. Again the pricing was very impressive. If I pay for an year then it would cost me roughly $2.8/month. And additionally there was a 50% off for annual subscription, that again brought down the monthly charges to $1.4. Great, I didn’t have to search further and opted the annual plan.

Getting started

In this post I will be discussing the steps to buy hosting service from NameCheap and moving the WordPress blog from AWS to NameCheap instance. I have prepared a video on configuring Let’s Encrypt Free TLS/SSL with WordPress blogs hosted under CPanel.  My domain name was bought from NameCheap a few months ago. So the steps to configure DNS was quite easy. So basically we will discuss the following in this post:

  1. Buying NameCheap hosting instance
  2. Enabling SSH on a NameCheap shared hosting instance which can only be managed with CPanel
  3. Backup and Restore the blog from AWS EC2 to NameCheap shared hosting instance
  4. Viewing and setting up the blog/website before actual DNS is set (HOSTS.CX)
  5. DNS configuration

Let’s go ahead and see how to do all these.

Buying a shared hosting instance from NameCheap
Goto https://www.namecheap.com/hosting/shared/ for details about namecheap hosting.
Namecheap_hosting_details
 
The plan costs $30 for an year and there is 50% off for first year with the coupon code NEWPURCHASEONLY. This when applied let’s you purchase the stellar plan for just $15 which is more than enough for a WordPress blog.
 
Login to the CPanel

Once the purchase is successful the cpanel credentials and receipt will be sent to the registered email. Check your email address and find the details. And Login to the CPanel. This is self explanatory.

 
Enabling SSH access in NameCheap shared hosting instance
 
In order to enable the SSH access, first go to Manage shell
 cPanel Enable ssh
Then click on the enable button.
cPanel enable SSH
Shell access will be provided on the server. Now we need to create SSH keys in order to get authorization to the server. To do this click on the Manage SSH Keys button. It will take you to a new window. Click Generate a New Key from that window.
Generate ssh key cpanel
You can provide any name in the Key Name field. It is just to identify the key when we go back to the console. Then provide a strong password for the Key. Let’s make the Key Type and Key Size as the standard values. Now click on Generate Key. A new window will popup with a success message and the Key FingerPrint.
cPanel SSH Access confirmed
Now click on Go back so that you can see the created key in the list. Authorize ssh keys cpanel namecheap
Click on Manage and then click on Authorize Button. So you will get a message saying that the key is authorized to use.
SSH key authorized namecheap cpanel
Again click on Go back. Now we need to download the Private Key to our local machine in order to use SSH. To do this click on View/Download under Private keys tab. Public keys are meant to be stored at Server to verify the authorization.
Download private key

You can Download the key and if you are using PuTty you may convert the key to PPK format before downloading. Once you have downloaded the key to login the server use the command

ssh -i id_rsa username@ip -pport

id_rsa is the private key we have just downloaded, username and server IP will be mailed to you once you have completed creating the hosting account. If you are unable to find it in your mailbox, goto the CPanel dashboard and there you can see the server information button button. There you can see the username also.

cpanel server details

Click on the Server information link beneath that section to get the IP.

cpanel server details

Now we have all the information we wanted. Let’s login to the server and see what’s inside.
 SSH login cpanel namecheap
That’s all about gaining SSH access to the cloud linux server provided by Namecheap.
 
Backup and Restore the blog from AWS EC2 to NameCheap shared hosting instance

That’s all about gaining SSH access to the cloud linux server provided by Namecheap.

Let’s go ahead and move our WordPress blog from AWS ec2 to namecheap shared hosting. The idea is to take a backup from aws, store it somewhere in the cloud, install a fresh WordPress app in Namecheap and restore it to namecheap server.

First let’s go ahead and install a plugin that help us to backup the current blog. You can find many plugins that does the work neatly. I am going to use UpdraftPlus for this purpose. This is free plugin (of course you need top pay for advance usage, but free version would be enough for our purpose). It has also got nearly a 5 star rating from around 3000 WordPress users which makes it a trusted plugin for me.

Install Updraft plus plugin in namecheap

Goto the WordPress admin panel and install the UpdraftPlus plugin. Once the installation is complete, goto settings and click on UpdraftPlus Backups. We can easily create backups to the aws instance by simply clicking on the blue Backup Now button. You can save the backup to remote storage such as Google drive if you want. Which makes it easier for you to download the backup to the local machine at a later stage.

 Backup with updrift plus

Once the backup is completed, it will reflect in the page as shown below.

Backup complete status updraft plus

You can click and download the backup to yur local machine now or do it later from the Google Drive backup. I actually stored it to my Google Drive for later use.

How to test the web application/blog on NameCheap shared hosting before DNS is actually set

Now, let’s move on to the namecheap server, point DNS and install wordpress there. There exist a problem here. We need to verify whether the application would work as expected before setting up the DNS and installing WordPress. Because once we have configured DNS all the requests to that domain will be routed to the new Namecheap server. If the server isn’t configured properly, we may face a downtime during the migration. We cannot check this by calling the application url, because we haven’t pointed the DNS yet. We cannot access the server by an IP address, because the instance is under a shared hosting plan. So, how do we see the application in the browser while configuring it?

A good option is to set the DNS locally in /etc/hosts file and test the app so that live users won’t be affected. But I will tell you a more easy approach. The solution is hosts.cx. Here you can point your shared hosting IP address to the domain name you have registered temporarily. Hosts.cx will point the domain to that IP and generate a temporary url with which you can access your namecheap server.

hosts cx temporary dns pointer

Copy the temporary url. Mine was something like http://n1403.hosts.cx/. Now lets SSH into the server and add an index.html file see whether it works. To do this SSH to the server as explained above. And cd to public_html/ folder. This is the directory where your web application will be configured.

aceess public_html namecheap server

Now lets create an index file in this directory. Type nano index.html so that nano will create the file. Paste the following into nano and press ctrl+x followed by y to save it.

<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>

namecheap index file creation

Now that the index file is created. Lets go ahead and test whether this is working. To do it load the url we have generated before using hosts.cx.

namecheap server testing success

So that the server works properly. Now let’s start installing WordPress to this instance.  

Installing WordPress using CPanel on NameCheap shared Hosting instance

The easiest method is to install WordPress using Softaculuos application installer plugin provided by CPanel. Scroll down to the bottom of your Cpanel Dashboard to access this.

 Softaculuos app installer

In the window click the drop down near the Install button and choose custom install.

wordpress custom install

Change the admin username and password as desired. Also, change the email address to your desired email address from admin@yourapp.com. Because, we haven’t set up a working email server for our application yet. I used my personal email address here. Let’s leave the other fields as such for now and click Install.

change wordpress admin details

Once the installation is completed, let’s go back to the test url http://n1403.hosts.cx/ and verify that the installation is success.

Wordpress install success

That works!

Restoring the Backup to New WordPress instance

Let’s go ahead and restore the backup now. Go to the WordPress admin panel http://n1403.hosts.cx/wp-admin/ login with the credentials we have created previously and install the UpdraftPlus plugin.

Now move the previously downloaded backup files to the namecheap hosting server. Go to the CPanel dashboard and click on File Manager. This will show all the files in the server. Click on the Upload button on top of the window.

File manager cpanel

Choose the backup file from this window. It will start uploading the file.

Upload file cpanel

Once this is complete click Go back. This will be visible in the files section. We have uploaded a zip file. So we need to extract it. To do this right click on the zip file and click extract. Just like you do in any computer. After that we need to move the extracted contents to to the Updrafts folder under /public_html/wp-content/updraft. Select all the zip files by pressing and holding ctrl button then right click  and press Move. Set the directory as /public_html/wp-content/updraft and click move files. This will be moved to the specified directory.

Move backup files to updrafts directory

Now let’s go back and check if Updraft Plus plugin can find the backup files. Go to the Updraftplus plugin’s page and scroll down to view Existing Backups. Currently you may not see anything there. So click Rescan remote storage. The backup will appear now as shown below.

 Updraft plus backup

Click on Restore and it will start restoring the backup. Make sure to select all the components.

Updraft plus restore

This will take a moment and your blog will be backed up. Now you can use your old username and password(for the blog that is in aws) to login to the admin panel. The temporary url will be updated to https. In my case the updated url was https://www-n1403.hosts.cx

The upgradation from http to https happens because I used SSL for my blog in AWS. When the backup was restored, the core WordPress files were re-written as https.

Restore complete

So we confirm that the blog works perfectly fine and the restoration was successful. Its time to change the DNS and get rid of hosts.cx.

Changing the DNS

Lets go ahead and change the DNS settings. Since we already have my Domain Name registered with NameCheap, I only needed to change the name servers  to the following. 

dns1.namecheaphosting.com
dns2.namecheaphosting.com

You can do this under the namecheap domain dashboard as shown below. Save this configuration and wait, it may take upto 48 Hours to reflect the changes globally.

Change namecheap nameserver

PS: If your domain is registered with any other domain name providers such as GoDaddy, you can consider transferring the domain name to NameCheap.

So that’s it. For me, DNS propagation tool only a couple of hours and my blog was available under the url https://www.wst.space. Note that, we haven’t yet configured TLS for the blog, so it will be available only under http. This may return a TLS error in browser at first. If you prefer to stay with http only, then you can change the site url from https to http under wp-admin>settings>General>site settings. This will remove the browser warning.

If you wish to add a free SSL certificate to the blog, Let’s Encrypt is the best solution. I have prepared a video on configuring this with WordPress.

 

Thanks for the read and feel free to visit occasionally 🙂


Clap if you like reading this article

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *