Free SSL Certificate For WordPress On Google Cloud.


🖊 Written by Updated on
SSL Certificate on GCP

This article will see how to set up a Free SSL Certificate for Bitnami WordPress or WordPress on Google Cloud Hosting Easily.

In this process need some Linux command, But don’t fear it because I have to note down below all command line that needs our setting up procedures.

Everyone knows that Google is the most prominent Internet Company in the world. Google provides hosting and other cloud services for consumers. We have already seen or read in our previous article “How To Host A WordPress Website On Google Cloud.”

Connect the VM instances with SSH

Google Cloud Compute Engine

Click Compute Engine then select VM instances page for access your WordPress installed VM.

IP Address on GCP

After opening the VM instances, we will connect our WordPress VM with SSH. So we can use the command line and quickly set up the SSL certificate on our website.

Generate the SSL Certificate with Commands

When we have connected with SSH, we will give a command to generate the SSL Certificate.

SSH Connection For SSL Certificate

For example, if your email address is [email protected] and your domain is example.com or www.example.com, then your certificate generating command will be this:

sudo /opt/bitnami/letsencrypt/scripts/generate-certificate.sh -m [email protected] -d example.com -d www.example.com

Configuration of the SSL Certificates.

In this step, we will configure our SSL certificate after giving the command above note down. After giving the SSL certificate issuing command, the compute engine will prompt some YES or NO authorization. I will prefer to type the Y and hit enter, like the pictures below.

SSL Certificate Configuration On GCP

Configuration of HTTPS Redirection

After generating the SSL certificate, we will configure the redirection of HTTP traffic to HTTPS traffic.

So in this step, we need one more command:

sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf
Set HTTPS Redirection

After this command, there will be open a new page like in the picture below.

Add Redirection Code

Now we will add some line of code between these two lines sowing above the picture. The code is:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://www.example.com/$1 [R,L]

After adding these three code lines, we will save the bitnami.confi by using keyboard keys CTRL+X then Y, and then click Enter to save.

Important Note: These three lines of code in the last line used “https://www.example.com” change as it is your domain name.

Now you will see the bitnami.confi file like this after adding these three lines of code.

Add Redirection Code

Now everything is done, we are going to restart our apache server for all these changes. So our last step is to restart Apache Server.

Restart Apache Server 

Use the following command to restart apache server:

sudo /opt/bitnami/ctlscript.sh restart apache
Restart Apache Server

There we go, our SSL certificate installation is complete.

Wrapping Up

If you have a WordPress instance on Google Cloud and want to add an SSL certificate for your website, you can follow the given steps.

By-the-way, you can use other methods, but this method is particularly for Bitnami WordPress instance.

If your WordPress website is hosted a shared hosting and using cPanel, you can install the free SSL certificate on cPanel.

If you have any issues during installation or have questions about the SSL certificate, please leave comments in the comment section. I am willing to help you.

Recommended Articles


Please Share & Support ♥
Pronay

Hi!
I am a blogger and a digital marketer based in Delhi, India. I have a passion for blogging and influencing people from my work. I am a student pursuing a Bachelor's Degree in Science from Delhi University.

Leave a Comment