Thursday, August 20, 2020

Step By Step Guide To Install SSL Certificate On Google Cloud Platform

 Install SSL certificate on the Google cloud platform on Bitnami. and any other apache server.


This is a step by step guide to install the free SSL certificate for WordPress website that runs on Google cloud platform and most importantly this is for bitnami WordPress .(bitnami version)

Let’s start to install an SSL certificate on Google cloud platform.

Remember to replace your domain with example.com


First you have to log in to the Google Cloud Platform and After that Go to compute engine and then click on VM instances.

Connect WordPress with ssh by clicking on ssh button

Now you have been successfully connected with the server. In this window Paste below command.

·                     wget https://dl.eff.org/certbot-auto && chmod a+x certbot-auto


Press Enter

Next will take care of the auto-renewal SSL certificate so you don’t have to renew your certificate by yourself.

Use the below command (Make sure you add your own domain )

·                     ./certbot-auto certonly --webroot -w /opt/bitnami/apps/wordpress/htdocs/ -d example.com -d www.example.com



Press Enter

Press Y to Continue

Type your email address

Press A for agree

Press N if you do not want to share your email or you can Press Y if want to share your email


Now you should see Congratulation message, (like you’re seeing in the above image) that means you have successfully generated an SSL certificate.
 (You have successfully Installed free SSL certificate for bitnami WordPress)


Now to test our auto-renewal SSL certificate functionality.

·                     ./certbot-auto renew --dry-run


Press Enter

If you see Congratulation That means your auto-renewal function is working.

Now in the next step, you have to set up a crontab. in general, crontab will check the SSL certificate is SSL certificate due for renewal if yes then it will automatically renew it.

Now paste the below command

·                     sudo crontab -e


Press Enter.

Here you have to choose text editor 1-3 to create the crontab
Press 1  (This is nano, easiest text editor.)

Press Enter

Using the down arrow from your keyboard and place your cursor below the last line in this window and paste the following Command

·                     0 0 * * * ./certbot-auto renew --quiet --no-self-upgrade

·                     0 12 * * * ./certbot-auto renew --quiet --no-self-upgrade


This command will tell certbot to check for the auto-renewal SSL certificate two times a today, other words it will Install free SSL certificate by itself.

After pasting this command Press Ctrl+x and then Press Y  for yes, lastly Press Enter

In the next step we have to configure the SSL certificate. Now use the below Command.

·                     sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf


With this command it will open up our bitnami configuration.

Go to the middle using you down arrow key. (see above image)

Execute the below command

·                     ServerName www.example.com

·                     ServerAlias example.com

·                     Redirect permanent / https://www.example.com/


This command going to tell our server to server only (https) secure connection on this website.



Do not forget to replace example.com with your own domain name.

Note: you can use WWW on your website or you can remove it. it is a person preference.

Do not Press Enter yet



In this same page scroll down using your down arrow key, go where you see two line of SSL certificate text (see the image) 



In front of these two lines Type #

below these two lines you should Paste the path of SSL certificate.

Paste the following command.

·                     SSLCertificateFile "/etc/letsencrypt/live/example.com/cert.pem"

·                     SSLCertificateKeyFile "/etc/letsencrypt/live/example.com/privkey.pem"

·                     SSLCertificateChainFile "/etc/letsencrypt/live/example.com/chain.pem"

Remember to replace your domain with example.com


After pasting this command Press Ctrl+x and then Press Y  for yes, lastly Press Enter

In the next step you should change your WordPress website URL from WP-config  file

Execute the command below to open your WP-config file

·                     sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php


Press Enter
Go to the middle of the Page by pressing down arrow key and locate these two lines of code (see the above image)

Replace these two lines with below command (delete them and add new lines from below)

·                     define('WP_HOME','https://www.example.com');

·                     define('WP_SITEURL','https://www.example.com');


Understand this one more time

Replace this code

define(‘WP_SITEURL’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/’);

define(‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] . ‘/’);

with this code

define(‘WP_HOME’,’https://www.example.com’);

define(‘WP_SITEURL’,’https://www.example.com’);


Keep in mind that you must replace your domain name with example.com moreover you can use WWW to run your website or you can go with https://example.com


After pasting this command Press Ctrl+x and then Press Y  for yes, lastly 

Press Enter



lastly Restart your Apache Serve

Execute the command below to restart Apache server

·                     sudo /opt/bitnami/ctlscript.sh restart apache


Congratulation ! You have successfully installed SSL certificate on your website now you can check out your website.

if you have any question regarding this tutorial feel free to ask anything regarding this topic.

Previous Post
Next Post

0 comments: