GCP — Install WordPress on Google Cloud Platform with Custom Domain

Didik Mulyadi
4 min readSep 15, 2022

--

Photo by Fikret tozak on Unsplash

Hello everyone!

I wanna share my task in my office regarding creating a WordPress website as a demo web for our WordPress plugin called “WooFlick”.

I will share about what’s WooFlick :D

What are goals?

  • Host WordPress in Google
  • Access WordPress web with a custom domain
  • use Https

My Tools:

  • Google Compute Engine
  • WordPress
  • Google Domains
  • CertBot

Step 1 — Go to Google Cloud Marketplace

https://console.cloud.google.com/marketplace

We will install WordPress by Marketplace. I use this WordPress just to install our WordPress plugin. So, I choose the easiest way!

Step 2 — Install Marketplace

https://console.cloud.google.com/marketplace/product/click-to-deploy-images/wordpress

Launch! 🚀

Setup Page

It will open a new page to you set up a WordPress. In this article, I will use the cheapest spec.

https://console.cloud.google.com/marketplace/vm/config/click-to-deploy-images/wordpress
  • Deployment name: Virtual machine name
  • Zone: us-central1-a (the cheapest price)
  • Series: E2 (e2-micro 2 vCPU, 1GB memory)

Let’s click deploy! Now, you are deployed WordPress to your cloud 🥳

Step 3 — See your deployment result

https://console.cloud.google.com/dm/deployments

Click the details, you will see information regarding your WordPress.

See “Site Address” (External IP) and SSH button. We will use it

Step 4— Connect to a custom domain (Google Domains)

Just create an A record with that IP. I put that (External IP) to subdomain.

Google Domains — DNS Management

At this step, you can access your virtual machine with a custom domain 🥳

Step 5— Add HTTPS by creating a certificate via SSH

Click the “SSH” Button, It will open a new tab

Google Compute Engine SSH

Step 5.1 — See your operating system

Run this command to see your OS lsb_release -a . My SSH show “Debian 10 (buster)”

Command Result

Step 5.2 — Open CertBot

https://certbot.eff.org/instructions?ws=apache&os=debianbuster

Follow the instructions from certBot

https://certbot.eff.org/instructions?ws=apache&os=debianbuster

The first installation is “Install snapd”

https://snapcraft.io/docs/installing-snap-on-debian
$ sudo apt update
$ sudo apt install snapd
$ sudo snap install core

Continue the installation process from CertBot until point 7

Step 5.3 — “sudo certbot — apache”

in point 7, You will run this command to install the certificate

sudo certbot — apache

Now, you can access your domain with https:// 🥳

Step 6 — Update Site URL in WordPress Admin Page

Login to your IP/wp-login.

[URL]/wp-admin/options-general.php

Done.

Thank you for reading my article!
Reach me on Linkedln. 🚀

Learn More

--

--