How to create a HTTPS WordPress Site easily and cheaply

Just a few months back, I was hosting my website on an AWS EC2 instance. I was a satisfied customer and I constantly recommend this method of hosting. Though, I must admit the initial learning curve is a little steep for a simple task of creating a WordPress site. The tutorials didn’t help me much either. Many of the tutorials (such as this and this) were very cryptic to me, even as a software developer. It made me feel a little stupid… In the end, I followed this guide (which is slightly simpler than the others) to create a WordPress site using an AWS EC2 instance to host it. However, later I realized that I wanted my site to be accessed via HTTPS protocol. And as a stingy poor student, I manually configured the SSL required to show the green little lock icon to my site visitors. I even wrote a guide for my own future reference. I only wanted to show that my site is legit.

Just a week ago, I changed my method of hosting this website to AWS Lightsail and Cloudflare. It was so darn easy!! I was really impressed with how easy it was and how cheap it is too so I am writing this guide to show you how to do it. Just for reference, the initial method of using AWS EC2 to host cost about USD $7-$8 a month. This method of hosting cost a flat USD $5. Here it goes.

 

You will need:

Step 1: Create an AWS Lightsail Instance

After logging into your AWS Console account, click on “Services” and you will see a drop-down. Type in “Lightsail” and click on it. You should be greeted with a welcome page (if you are new). Click on “Get Started“. If you don’t see that, just click on “Create Instance“. It’s the same either way.

 

You should see this page.

Here, you can edit your instance location. The instance location decides where your instance will be hosted. If you expect the bulk of your visitors to be from a certain region, then you might want to have your instance hosted in that region.

Select Linux/Unix as your platform. Select WordPress as your blueprint. Scroll down and select the usage you need. For starters, the $5 plan would probably meet your needs. Select that and type in the name you want to call it.

Click Create.

You should see the instance is created and booting up.

Once it’s running, you can click on it and you will arrive at this page.

 

Step 2: Set up Cloudflare

Notice the Public IP for your instance. If you copy and enter it into your address bar, you will go to your WordPress website. However, it is difficult for visitors to remember this string of numbers. That is why we give it a domain name such as www.example.com which is easier to remember.

In this guide, I am going to assume you have already purchased a domain name. If not, you can purchase one via websites such as GoDaddy. I purchased mine with AWS Route 53 – Another AWS service that allows you to purchase domains and manage them.

During your Cloudflare account registration, you will be prompted to enter your site name. This is the domain name you have purchased. You will only need the free plan to host an HTTPS WordPress site, so select that.

As you are being prompted for your account registration, you will eventually reach this page.

Take note of the nameservers assigned to you. In the example above, it is “glen.ns.cloudflare.com” and “pam.ns.cloudflare.com“.

Step 3: Changing nameservers

This step depends on which domain registrar you use to purchase your domain. If you use GoDaddy, you may need to contact them for instructions on how to change nameservers.

In this step, I am assuming you use AWS Route 53 to manage your domain. In many cases, the steps it takes to change nameserver is largely similar, so you may want to browse through this step for reference.

So, again on your AWS Console services, select Route 53. On the left, click on Hosted zones and then select your domain name. You should see something like this.

Delete both the Type A records.

Then, click on the NS record. Replace the existing values with the two Cloudflare nameservers you’ve retrieved in Step 2. Make sure to put them in separate rows.

Click Save Record Set to save the changes.

Next, specifically for AWS Route 53, you need to change the NS in another configuration for the change to be effective. Still under Route 53, click on Registered Domains then select your domain. You should see this page.

Click on Add or edit name servers. Replace the current records with the same Cloudflare nameservers you retrieved from Step 2. Remember to save the changes.

Step 4: Configure DNS

Now that your domain name is using Cloudflare nameservers, you have to configure Cloudflare to point to the write place. After registering your account and domain name with Cloudflare, you will reach an overview page. At the top, click on DNS.

Delete any existing A Records.

Then, add new A Records as shown below. One record should be your domain name (e.g. example.com). Another record should be your domain name with a www prefix (e.g. www.example.com). Both the record should point towards the IP address of your Lightsail instance. This is the Public IP you’ve retrieved in Step 1.

 

Step 5: Configure HTTPS

At the top of your Cloudflare page, click on Crypto. On the drop-down in SSL, select Flexible. You might have to wait a while for it to be active. Once active, you will see “Status Active Certificate” being displayed as shown below.

Important: Even if it is shown as “Flexible” already, make sure to click on the drop down and select it again. Sometimes, there is a bug and Cloudflare might not select “Flexible” despite displaying as such.

Next, scroll down and turn Always Use HTTPS on.

After your SSL is active, navigate to Page Rules by clicking on it at the top. Click Create Page Rule and create the rule as shown.

 

Optionally, you may want to install Really Simple SSL WordPress plugin for your website too.

And… You are done! Congratulations! You have created a WordPress site with HTTPS.

For the more advanced users, there are situations when you need to SSH into your Lightsail instances for whatever reasons. It is very easy to do that as well. But I will leave the explanation to the future and update here with the new guide. For now, I just want you to know you can SSH into a Lightsail instance and access any files inside.

Do not hesitate to contact me or comment below if you have any questions! Enjoy your new website! 🙂

2 comments On How to create a HTTPS WordPress Site easily and cheaply

  • Hello ,

    I saw your tweets and thought I will check your website. Have to say it looks very good!
    I’m also interested in this topic and have recently started my journey as young entrepreneur.

    I’m also looking for the ways on how to promote my website. I have tried AdSense and Facebok Ads, however it is getting very expensive. Was thinking about starting using analytics. Do you recommend it?
    Can you recommend something what works best for you?

    Would appreciate, if you can have a quick look at my website and give me an advice what I should improve: http://janzac.com/
    (Recently I have added a new page about FutureNet and the way how users can make money on this social networking portal.)

    I wanted to subscribe to your newsletter, but I couldn’t find it. Do you have it?

    Hope to hear from you soon.

    P.S.
    Maybe I will add link to your website on my website and you will add link to my website on your website? It will improve SEO of our websites, right? What do you think?

    Regards
    Jan Zac

  • Hello ,

    I saw your tweet about animals and thought I will check your website. I like it!

    I love pets. I have two beautiful thai cats called Tammy(female) and Yommo(male). Yommo is 1 year older than Tommy. He acts like a bigger brother for her. 🙂
    I have even created an Instagram account for them ( https://www.instagram.com/tayo_home/ ) and probably soon they will have more followers than me (kinda funny).

    I have subscribed to your newsletter. 🙂

    Keep up the good work on your blog.

    Regards
    Wiki

Leave a reply:

Your email address will not be published.

Bitnami