A.I, Data and Software Engineering

Install and Update SSL certificate for Google Compute Engine

I

This quick-start tutorial you will learn how to configure free, auto-renewing SSL certificates for WordPress websites that are hosted on Google Cloud compute engine using the Click-to-Deploy version on Google Cloud. To setup Free SSL for WordPress on Google Cloud (Click-to-Deploy),

Prerequisites:

  • Your website is up and running
  • Your domain name(s) are resolved*

Steps to set up SSL

Connect to VM instance using SSL

  1. In the GCP Console, go to the VM Instances page.
  2. In the list of virtual machine instances, click SSH in the row of the instance that you want to connect to.
SSH button next to instance name.
Use SSH to connect to VM instance

Check Operating System

lsb_release -a
#No LSB modules are available.
#Distributor ID: Debian
#Description:    Debian GNU/Linux 9.11 (stretch) <---- REMEMBER THIS!
#Release:        9.11
#Codename:       stretch
#root@wordpress-1-vm:/etc/apache2/sites-available# 

Get instructions from Certbot

  • Go to certbot.eff.org
  • Go to instructions and select your system configurations
  • Run the command in the ssh terminal
Generate instructions from certbot
Generate instructions from Certbot
sudo apt-get install certbot python-certbot-apache -t stretch-backports

Generate SSL certificates

Return to the certbot.eff.org website and copy the second command. Return to your SSH terminal and paste the command that you copied in order to generate the SSL certificates, then press Enter.

sudo certbot --apache

You will be asked a series of questions. Make sure you select the right ones:

Enter email address: example@example.com
Term of service: a (agree)
Share email address: n (no)
Enter domain names: yourdomain1.com www.yourdomain1.com
which virtual host: 000-default-le-ssl.conf (2)
Whether redirect: 2

Restart Apache Server

sudo service apache2 restart

You can then update your website url to https. For example: https://example.com

Expand your domains

You may need to add more domain names to the current website that already have SSL certificate.

Warning: Removing the existing certificate will likely stop Apache server from running! You will need to prepare for that. Do not remove it if you just want to update the certificate.

To expand your domain names for SSL certificate, use the following command:

certbot certonly --cert-name example.com -d newexample.org,www.newexample.org

Restart Apache server using the previous provided command.

That’s it!

Is it simple? If you run into any issues with your certificates and want to verify that they’re configured properly, check out the SSL Checker tool.

Add comment

💬

A.I, Data and Software Engineering

PetaMinds focuses on developing the coolest topics in data science, A.I, and programming, and make them so digestible for everyone to learn and create amazing applications in a short time.

Categories