Setup Free SSL Certificate on Google Cloud (Bitnami)
In this quick-start tutorial you will learn how to configure free, auto-renewing SSL certificates for WordPress websites that are hosted on Google Cloud Platform compute engine using the Bitnami version of WordPress on Google Cloud Platform.
Before getting started with this tutorial, you should have already:
There are 8 steps in this tutorial:
- Connect to WordPress via SSH.
- Install CertBot Client.
- Generate Certificates.
- Test Certificate Renewal.
- Setup Auto-Renewal.
- Configure the Certificates.
- Update Domain URLs.
- Restart your Apache Server & Hide Bitnami Logo
So let’s get started…
1. Connect to WordPress via SSH
2. Install CertBot Client
Code – wget https://dl.eff.org/certbot-auto && chmod a+x certbot-auto |
After executing each of these commands, you can either stay in the same SSH window or exit and open a new one.
3. Generate Certificates
In this step you are going to execute the command below in order to tell the Certbot client to create SSL certificates for your website. Remember to replace dofollowbacklinks.org with your own domain name.
Code – ./certbot-auto certonly –webroot -w /opt/bitnami/apps/wordpress/htdocs/ -d YourDomainName.com -d www.YourDomainName.com |
4. Test Certificate Renewal
Code – ./certbot-auto renew –dry-run |
5. Setup Auto-Renewal
Code – sudo crontab -e |
Code – 0 0 * * * ./certbot-auto renew –quiet –no-self-upgrade 0 12 * * * ./certbot-auto renew –quiet –no-self-upgrade |
After adding this code, enter ctrl+o to save changes, followed by ctrl+x to exit back to your home screen.
6. Configure the Certificates
Code – sudo nano /opt/bitnami/apache2/conf/bitnami/bitnami.conf |
Code – ServerName www.YourDoainName.com ServerAlias YourDoainName.com Redirect permanent / https://YourDoainName.com/ |
Code – SSLCertificateFile “/etc/letsencrypt/live/YourDoainName.com/cert.pem” SSLCertificateKeyFile “/etc/letsencrypt/live/YourDoainName.com/privkey.pem” SSLCertificateChainFile “/etc/letsencrypt/live/YourDoainName.com/chain.pem” |
After adding this code, enter ctrl+o to save changes, followed by ctrl+x to exit back to your home screen.
7. Update Domain URLs
Changing your website URLs via Settings > General is disabled in the Bitnami version, so you’ll need to change your URLs by editing your wp-config.php folder.
Code – sudo nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php |
REPLACE THIS:
define(‘WP_HOME’,’http://YourDoainName.com’); WITH: define(‘WP_HOME’,’https://YourDoainName.com’); OR REPLACE THIS: define(‘WP_SITEURL’, ‘https://’ . $_SERVER[‘HTTP_HOST’] . ‘/’); WITH: define(‘WP_HOME’,’https://YourDoainName.com’); |
8. Restart your Apache Server & Hide Bitnami Logo
Code – sudo /opt/bitnami/ctlscript.sh restart apache |
LOGO Hide Code – sudo /opt/bitnami/apps/wordpress/bnconfig –disable_banner 1 |
That’s it!
YouTube Video
Previous Setup
1. Installed WordPress on Google Cloud.