Welcome to our Google Cloud Platform guide. Today we will be discussing about hosting your WordPress on Google Cloud, GCP’s Always-Free & $300 Free Credit, How to create an account, Spinning up an Instance, tweaking it and installing LEMP Stack + WordPress CMS.

wordpress-on-google-cloud

Here are the things you need for this tutorial :

  • A Google Cloud Account (Read More Below)
  • Domain Name.
  • CloudFlare Free Account.

Google Cloud Platform : Short Review :

Google Cloud Platform is a suite of apps and engines that Google itself uses to deliver its products; i.e Youtube, Google Earth, ETC. In the suite, Google provides over 90 products, Such as App Engine, Kubernetes Engine, Compute Engine, Cloud Storage, Managed SQL and much more. If You like to read more about the other tools, Read our Review of Google Cloud Platform.

wordpress-on-gcp

Step 1 : Creating an Account :

Supposing you already have a google account, Head over to GCP Portal and sign up for a new account. You will also get $300 Promotional credit which we will use to avail top-tier web hosting free for a whole year.

Step 2 : Create a new Project :

Now Head over to the Google Cloud Console and create a new project by going to the main menu bar :
gcp-new-project

Select the New Project icon, Supply a name and wait for a second, your new project will be built successfully and now open by default on GCP Console. If not, Select it to make it active. Think of projects as working directory, Each project can have different structures and resources.

Step 3 : Enable Cloud Compute Engine API :

To use Cloud engines, You must first enable its API on your project. To do this, Go to the Cloud Console API Library, Select your project, Search for Compute Engine API, Select it and enable it for your project.

Step 4 : Creating a Compute Engine Instance :

Head again to your console, With your project selected and Compute Engine API Enabled, Open the Compute Engine Menu, Select Create New Instance. Provide it with a name (Default host.domain.tld), Select region and zone to US-Central1.

On Machine configuration, Select
Machine family : General Purpose;
Series : N1;
Machine Type : N1-Standard-1 (1v Core, 3.75GB Of RAM)

Scroll Down to the Boot disk Section, Click on it and set these parameters :
Operating System : Debian;
Version : 10;
Boot disk type : SSD, Space 15GB; (Increase if required)

Scroll Down to the Identity and API access, Select Compute Engine Default Service Account. In Access Scope Allow Default Access and in Firewall select Allow HTTP and HTTPS service checkbox.

Now click on Management, security, disks, networking, sole tenancy icon, Select Networking and insert a proper hostname (host.yourdomain.com) in hostname section. Also select the External IP Section to get an external IP that you’ll need to map to your DNS.

Click Create. This whole setup will cost you about $26 per month, And for the first year the whole cost will be deducted from your free credits.

Step 5 : Setting up the instance :

Connect to your new instance by using SSH -> Connect in Browser Window.
Start Issuing these commands :

//Getting elevated privileges and updating system :

linux-swap
See James Hayden Article on why Swap is necessary.

 

 

sudo -i
apt-get update
apt-get upgrade

//Setting Up Swap :

fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
nano /etc/fstab
paste : /swapfile swap swap defaults 0 0
nano /etc/sysctl.conf
paste : vm.swappiness=10

//Installing Wordops For LEMP Stack Automation :

wordops-on-google-cloud
Click to visit WordOps Repo.

wget -qO wo wops.cc && bash wo
wo site create example.com --wpredis
source /etc/bash_completion.d/wo_auto.rc
wo stack install
wo site create host.example.com -le
wo stack install --ufw

 

Step 6 : Making Connections :

Now Forward your Domain to your google cloud instance IP by setting proper A, AA and CNAME Certificates. When you have pointed then correctly, You can access the default WordPress website on your domain and WordOps Dev Tools on port 22222 (add exception in google cloud firewall) of your domain.

Note : Other Methods for installing WordPress On Google Cloud :

In this tutorial we used a Compute Engine to launch our custom LEMP Stack, There are other ways in which we can install WordPress on google cloud, some are even easier. You can deploy a scalable version of WordPress across multiple container (Docker) instances on GKE or You can deploy a scalable version of WordPress across multiple App Engine ( full managed server) instances.

gcp-different-wordpress
We use a Compute Engine as it provides us with very efficient cost structure, Also we have no problem setting up an instance or two !

Congratulations of getting Top-Tier web hosting for free for over a year. Have Fun.

wordpress on google cloud. install wordpress on google cloud.  free hosting. wordpress gcp.