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.
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:
Let’s go ahead and see how to do all these.
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.
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.
Click on the Server information link beneath that section to get the IP.
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.
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.
Once the backup is completed, it will reflect in the page as shown below.
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.
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.
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.
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>
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.
So that the server works properly. Now let’s start installing WordPress to this 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.
In the window click the drop down near the Install button and choose custom install.
Change the admin username and password as desired. Also, change the email address to your desired email address from email@example.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.
Once the installation is completed, let’s go back to the test url http://n1403.hosts.cx/ and verify that the installation is success.
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.
Choose the backup file from this window. It will start uploading the file.
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.
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.
Click on Restore and it will start restoring the backup. Make sure to select all the components.
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.
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.
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.
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.
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 🙂
What is this web security checklist? Here is a curated web security checklist for developers… Read More
In the last part of the blog series we have seen the history of internet… Read More
Welcome back budding pen-testers. :) In the first part of the blog series we have… Read More