How to Configure HTTPS and Get a Free SSL for Your GCP Website Using Cloudflare


In today’s digital world, ensuring the security and privacy of your website visitors is of utmost importance. One of the key steps in achieving this is through the implementation of HTTPS and SSL. In this article, we’ll walk you through the process of configuring HTTPS and obtaining a free SSL certificate for your Google Cloud Platform (GCP) website using Cloudflare. Let’s dive in!

What is HTTPS?

Hyper Text Transfer Protocol Secure (HTTPS) is an extension of the HTTP protocol, which is used to transmit data securely between a user’s browser and the website they are visiting. HTTPS encrypts the data using an SSL or TLS certificate, ensuring that sensitive information remains confidential and secure.

Why is HTTPS Important?

HTTPS offers several benefits for website owners and their visitors:

  1. Security: It encrypts data, preventing unauthorized access and tampering.
  2. Privacy: It keeps sensitive information like login credentials, credit card numbers, and personal data secure.
  3. SEO: Search engines like Google favor HTTPS-enabled websites in their rankings.
  4. Trust: A secure connection is indicated by a padlock symbol in the browser’s address bar, increasing user trust.

What is SSL?

Secure Sockets Layer (SSL) is a cryptographic protocol that enables secure communication over a computer network. It uses encryption algorithms to secure the transmission of data between a user’s browser and a web server, ensuring that the data remains private and secure.

Why Use Cloudflare for SSL?

Cloudflare is a popular Content Delivery Network (CDN) and security provider that offers free SSL certificates and various other security features. Using Cloudflare for SSL allows you to:

  1. Obtain a free SSL certificate, saving on costs.
  2. Implement SSL quickly and easily.
  3. Leverage additional security features like DDoS protection and caching.
See also  Wix vs The Rest: Finding the Best Platform For Your Needs

Setting Up Your GCP Website

Creating a Virtual Machine on GCP

To begin, you’ll need to create a virtual machine (VM) on GCP:

  1. Sign up for a Google Cloud account if you haven’t already.
  2. Create a new project or select an existing one.
  3. Navigate to the “Compute Engine” section.
  4. Click on “Create Instance” and configure the VM based on your requirements.

Installing a Web Server

After creating your VM, install a web server like Apache or Nginx:

  1. SSH into your VM using the GCP console or an SSH client.
  2. Update your package manager by running sudo apt-get update.
  3. Install your preferred web server using the package manager, e.g., `sudo apt-get install apache2 for Apache or sudo apt-get install nginx for Nginx. 4. Start and enable the web server to run on system boot, e.g., sudo systemctl start apache2 && sudo systemctl enable apache2 for Apache or sudo systemctl start nginx && sudo systemctl enable nginx for Nginx.

Configuring Your Domain Name

To link your domain name to your GCP VM:

  1. Obtain your VM’s external IP address from the GCP console.
  2. Log in to your domain registrar and create an A record pointing to the VM’s IP address.

Configuring Cloudflare

Signing Up for Cloudflare

  1. Visit Cloudflare’s website and sign up for a free account.
  2. Enter your email address and create a password.

Adding Your Domain

  1. Click on “Add a Site” and enter your domain name.
  2. Select the free plan and click “Confirm Plan.”

Changing Your Nameservers

  1. Cloudflare will provide you with two nameservers.
  2. Log in to your domain registrar and replace your current nameservers with the ones provided by Cloudflare.
  3. Return to Cloudflare and click “Done, check nameservers.”
See also  Check for HTTPS

Configuring SSL on Cloudflare

Obtaining a Free SSL Certificate

  1. Once your domain is active on Cloudflare, navigate to the “SSL/TLS” tab.
  2. Under “Origin Server,” click “Create Certificate.”
  3. Choose “Let Cloudflare generate a private key and a CSR” and click “Next.”
  4. Copy the generated certificate and private key.

Setting Up SSL Mode

  1. In the “SSL/TLS” tab, select the “Overview” section.
  2. Choose “Full” or “Full (strict)” SSL mode.

Setting Up Page Rules

  1. Navigate to the “Page Rules” tab in Cloudflare.
  2. Click “Create Page Rule.”
  3. Enter your domain with an asterisk before and after, e.g., **.
  4. Select “Always Use HTTPS” as the setting and click “Save and Deploy.”

Verifying HTTPS on Your GCP Website

After completing the above steps, visit your website using your domain name. You should see a padlock symbol in your browser’s address bar, indicating that your site is now using HTTPS.


In this article, we’ve walked you through the process of configuring HTTPS and obtaining a free SSL certificate for your GCP website using Cloudflare. By following these steps, you can enhance your website’s security, privacy, and trustworthiness, benefiting both you and your visitors.


  1. Do I need to renew my free Cloudflare SSL certificate? No, Cloudflare automatically renews your free SSL certificate as needed.
  2. Can I use Cloudflare SSL with other web hosting providers? Yes, Cloudflare SSL can be used with any web hosting provider that allows custom SSL certificates.
  3. Will using Cloudflare affect my website’s performance? Cloudflare can improve your website’s performance by offering features like caching, load balancing, and DDoS protection.
  4. Can I use Cloudflare SSL with a subdomain? Yes, Cloudflare SSL can be used with subdomains. Make sure your subdomains are added to your Cloudflare account and configured properly.
  5. What is the difference between “Full” and “Full (strict)” SSL mode in Cloudflare? “Full” SSL mode encrypts traffic between Cloudflare and your origin server but doesn’t validate the certificate on your origin server. “Full (strict)” SSL mode encrypts traffic and also validates the certificate on your origin server, ensuring that it is signed by a trusted Certificate Authority (CA). The “Full (strict)” mode offers a higher level of security.
See also  Wix vs WordPress: Which is the Better Website Builder?

Similar Posts