Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Hosting and WordPress Last updated: August 4, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

A step-by-step guide to launching a high-performance WordPress site on Google Cloud Platform (GCP) using WordOps.

When you start as a blogger or running a small business, shared hosting is fine as it costs less, and no hosting skills are required to install/setup/maintain the infrastructure platform.

However, when your traffic or user base increases, you need a robust hosting platform to serve millions of customers without slowing down the site.

There are some premium hosting providers for heavy traffic websites, but that would easily cost $100+ per month.

Note: Kinsta recently announced a starter plan starting at $30 per month, which leverages GCP.

However, if you are ok with spending a little time learning and doing it by yourself, you can think about VPS/Cloud servers. This article will explain how to get a WordPress site running on the Google Cloud Platform in less than 15 minutes.

This setup would cost around $25 per month and ready to serve 500,000 page views per month. Post setup, I will do a load test to verify the performance.

Prerequisite

  • I assume you already have a domain; if not, you can buy from Namecheap or Google.
  • Google cloud account with billing enabled
  • Some WordPress themes, but I will use the Newspaper by Tag div.

Provision New Google Cloud Server

  • Log in to Google Cloud and go to Compute Engine >> VM Instances (direct link)
  • Click “Create Instance” and enter the required information.
  • Select the zone (choose the nearest location of your targetted audience)
  • Choose the machine type.
  • Change boot disk to Ubuntu 18.04 LTS and boot disk type to SSD persistent disk with 10 GB size.
  • Allow HTTP and HTTPS firewall and click Create

In a few seconds, you will have the new instance ready.

Installing WordPress using WordOps

There are multiple ways to install WordPress, but one of the easiest ways is using WordOps.

WordOps is a script wrapper that takes care of installing required components like a database, PHP-FPM, Nginx, WordPress, Redis, phpMyAdmin, etc. If you install them manually, then it may take longer, and room for human errors.

  • Login to newly created Google Cloud VM and switch to root user

Note: it’s recommended to setup sudo access to root from a regular user in production, but in this exercise, I will use root.

  • Install WordOps with the below command
wget -qO wo wops.cc && sudo bash wo
  • It will take a minute or two, and once done, you will be returned to the prompt.
Synchronizing wo database, please wait...
WordOps (wo) installed successfully

To enable bash-completion, just use the command:
bash -l

To install WordOps recommended stacks, you can use the command:
wo stack install

To create a first WordPress site, you can use the command:
wo site create site.tld --wp

WordOps Documentation : https://docs.wordops.net
WordOps Community Forum : https://community.wordops.net
WordOps Community Chat : https://chat.wordops.net

Give WordOps a GitHub star : https://github.com/WordOps/WordOps/

root@ubuntu-s-1vcpu-2gb-lon1-01:~#

Now it’s time to create a WordPress site. WordOps gives you an option if you want to install WordPress with caching plugins.

Currently, it supports WP Super, W3 Total, Nginx, Redis. I’ve tried all, and Redis always performed better for me.

  • Let’s create a site with Redis cache.
wo site create geekflarelab.com --wpredis

Above, I am asking WordOps to create a site for geekflarelab.com (It’s my lab domain) with Redis cache. It will take a minute or two and give you confirmation about site creation.

root@ubuntu-s-1vcpu-2gb-lon1-01:~# wo site create geekflarelab.com --wpredis
Start : wo-kernel [OK]
Adding repository for MySQL, please wait...
Adding repository for NGINX, please wait...
Adding repository for PHP, please wait...
Adding repository for Redis, please wait...
Updating apt-cache              [OK]
Installing APT packages         [OK]
Applying Nginx configuration templates
Testing Nginx configuration     [OK]
Restarting Nginx                [OK]
Testing Nginx configuration     [OK]
Restarting Nginx                [OK]
Configuring php7.2-fpm
Restarting php7.2-fpm           [OK]
Tuning MariaDB configuration
Stop  : mysql     [OK]
Start : mysql     [OK]
Tuning Redis configuration      [OK]
Restarting redis-server         [OK]
Running pre-update checks       [OK]
Setting up NGINX configuration 	[Done]
Setting up webroot 		[Done]
Downloading WordPress 		[Done]
Setting up database		[Done]
Configuring WordPress           [OK]
Installing WordPress            [OK]
Installing plugin nginx-helper  [OK]
Setting plugin nginx-helper     [OK]
Installing plugin redis-cache   [OK]
Testing Nginx configuration     [OK]
Reloading Nginx                 [OK]
HTTP Auth User Name: WordOps
HTTP Auth Password : XXXXXX
WordOps backend is available on https://XX.XX.XX.XX:22222 or https://ubuntu-s-1vcpu-2gb-lon1-01:22222
WordPress admin user : Chandan Kumar
WordPress admin password : lyWwnfOhD8XXXXXXNTS3vXri
Configure redis-cache:	http://geekflarelab.com/wp-admin/options-general.php?page=redis-cache
Object Cache:		Enable
Successfully created site http://geekflarelab.com
root@ubuntu-s-1vcpu-2gb-lon1-01:~#
  • Save the password securely.

WordPress is successfully installed, and it’s time to point your domain to server IP. That was easy. Isn’t it?

Getting Static IP

By default, Google Cloud assigns an ephemeral IP to the instance you don’t want to configure with the domain as it may change in the next instance reboot.

To avoid the risk, we will reserve a static IP.

  • Go to VPC Network >> External IP addresses from the left navigation.
  • Drop-down Ephemeral type and select static
  • Give the name and click RESERVE.
  • You will notice type is changed to Static.

GCP VM is ready with the static external IP and WordPress, and the last thing to do is map the domain to the static IP.

Update Domain A Record

  • Go to a domain registrar
  • Update the A record for your domain to the external IP you just reserved

It may take some time to get propagated globally. You can use the DNS record lookup tool to verify.

Once domain A record is updated, you can access the WordPress site with the domain you used with the WordOps command. In my example – http://geekflarelab.com

Performing Load Test

Let’s see how the newly setup WordPress site on Google Cloud Platform performs. Before doing a speed test, I will install a theme by Tagdiv, as mentioned earlier.

This is not necessary, but to ensure I have some post/media files to simulate the real-site scenario.

So as you can see, geekflarelab.com is ready on GCP.

There are multiple ways to perform benchmarking, and one of the easiest ways is to do it from a cloud. I used Loader.io to put a load for 100 to 500 users for a one-minute duration, and the results are:

Average response time = 695 ms

I know this is a basic WordPress setup and require installing additional plugins, add security, SSL certificate, etc. in a production environment. But that would increase the load time by a few percentages.

Conclusion

I hope this gives you an idea of how to set up WordPress on the Google Cloud Platform. This requires a little bit of time to set up and skills, but if you would like to save $$ per month, I believe it’s worth it.

Alternatively, if you don’t have time to set up or manage WordPress and at the same time want to enjoy Google Cloud, then you can try Cloudways managed hosting platform.

  • Chandan Kumar
    Author
    As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.
Thanks to our Sponsors
More great readings on Hosting
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder