Cloud Tutorial
Free SSL Certificate Setup for WordPress on Google Cloud (Bitnami version)
Install free ssl certificate for Bitnami WordPress on google cloud platform
This is step by step guide to install free SSL certificate for WordPress website that runs on Google cloud platform and most importantly this is for bitnami WordPress .(bitnami version), This is a letsencrypt renew guide as well on google cloud platform for WordPress bitnami version
SSl certificate will improve your search ranking.
So before moving in this tutorial you should complete 3 things first in order to install a SSL certificate.
First you should install WordPress on Google cloud platform (here)
Second you should point your domain with Google Cloud (here)
Third you need to reserve a static IP address on Google cloud platform (here)
I assume you have done these steps already.
🔥You can also read ultimate guide of create ecommerce website.
Now let's go ahead and install a SSL certificate on Google cloud platform.
Go to compute engine and then click on VM instances.
Â
Connect WordPress with ssh by clicking on ssh button
Now you Should successfully connected with server. In this window Paste below command.
wget https://dl.eff.org/certbot-auto && chmod a+x certbot-auto
Press Enter
Now you need to generate a SSL certificate so our Second command is Certbot auto renewal client. It 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 above image) that means you have successfully generated a SSL certificate.
(or letsencrypt renew has done, if your ssl expired.)
(You have successfully Install free SSL certificate for bitnami WordPress)
It's time to test our auto renewal SSL certificate functionality.
Next Paste below command
./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.) and then 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 letsencrypt renew auto renewal SSL certificate two time 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 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 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 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 Server
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.
Do not forget to subscribe to our Newsletter.
Check out our WordPress tutorials here