Setup Free SSL Certificate for WordPress on Google Cloud.

|

In this tutorial, you will install a free SSL certificate for your WordPress installation.

If you have followed along with our deployment from start to setup WordPress on Google cloud. this is the final step.

We have installed Google Click to Deploy a version of WordPress on Google Cloud. If you have installed another version of WordPress image in Google Cloud then, this tutorial will not work.

Before we start on this tutorial you should have,

  1. Installed WordPress on Google Cloud
  2. Assign Static IP address to your Google Cloud Compute Engine instance. (Important)
  3. Set up a Domain Name for your WordPress website

So let’s get started.

Let’s go ahead and install the Free SSL certificate.

This tutorial has 6 Step

  1. Connect to WordPress via SSH
  2. Get Certificate Instructions
  3. Install Certbot
  4. Generate SSL Certificates
  5. Restart Apache Server
  6. Update WordPress URLs

1. Connect to WordPress via SSH

Go to your Google Cloud Console and Click on Compute Engine and select VM instances from left navigation.

Now, in the next screen, you will see your WordPress VM,

Click the SSH button to connect to your WordPress VM instance.

Google Cloud Connect WordPress instance with ssh

After clicking on SSH, the new window with the SSH terminal will open.

Type the lsb_release -a to get the operations system version.

lsb_release -a

For the Google Click to Deploy WordPress the Operating system is Debian(stretch). please remember the version so you need to get the instruction for this version.

Google Cloud WordPress Click to Deploy Debian Stretch Operating system.

2. Get Certificate Instructions

After you have determined your operating system version go to https://certbot.eff.org and select your Software as Apache and System as Debian 9 (stretch) to get SSL certificate installation instruction.

Google Cloud WordPress SSL installation instruction.

3. Install Certbot

Now As Per the instruction first step is to Install Certbot.

Google Cloud WordPress Certbot Free SSL

Next, go to your SSH terminal and copy install certbot command from instruction.

Then press Enter to execute the command.

sudo apt-get install certbot python-certbot-apache

Enter Y  when asked and hit the ENTER key to proceed.

Google Cloud SSL certbot command.

4. Generate SSL Certificates

The Next Step in the instruction is to Generate an SSL Certificate.

Type, sudo certbot –apache to generate SSL Certificate then press ENTER.

sudo certbot --apache
Google Cloud Generate Free SSL Certificate for WordPress

After you press the ENTER there will be series of Question will be prompted answer the question as shown in below image.

  1. Enter an email address where security and renewal notices will be sent.
  2. Please agree on terms and conditions with typing A and then enter.
  3. If you don’t want to share your email address, then type N.
  4. enter the hostname of your domain in my case it’s myexampleblog.com, and www.myexampleblog.com
  5. enter the hostname that certbot finds for me. It was myexampleblog.com.
  6. If you want to redirect all traffic to HTTPS then please enter 2.
WordPress Google Cloud Certbot installation instruction

5.  Restart Apache Server

Restart the Apache Server after successful installation of certificate with following command.

sudo service apache2 restart
Google Cloud WordPress restart Apache server

6. Update WordPress URLs

Now, go to your WordPress dashboard and Settings => General and change the URL to https.

Google Cloud change WordPress URL.

Now, your site has SSL certificate installed, you can verify in the browser.

Google Cloud WordPress SSL installed.

That’s it

The Certbot packages on your system come with a cron job or systemd timer that will renew your certificates automatically before they expire. So, you don’t need to worry about the broken SSL certificate.

you can also check at SSL Checker tool or https://www.ssllabs.com/ssltest/ to verify your SSL certificate.

If you have any questions or comments, please don’t hesitate to post below.

Thanks.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.