How To Host A Static WordPress Site On GCP (Google Cloud)

I am using Google Cloud at work, so I wanted to start a website on there as well. Turns out it’s dirt cheap to host your website in a GCP bucket.

I looked at various static site generators to help me like Hugo, Pelican, and others. The reason being, so as to not have to worry about all the security aspects of hosting a WordPress site, with all the constant updates it requires. I was inspired by a chapter from Josh Kaufman’s The First 20 Hours: How to Learn Anything . . . Fast!. He writes about Jekyll, and Hugo is the logical one to choose should you go down that route.

I played around with quite a few of them and Hugo (Go) and Pelican (Python) are my favorites. Hugo is uber fast and efficient. They all support Markdown and I might end up going back to experiment some more with Hugo later on.

They were all interesting little experiments, but didn’t really meet my needs. I was already familiar with the concept on a self-hosted WordPress instance, however using WP2Static, I could accomplish the same thing, but with less effort to maintain, and it ticks the box of “one less thing to do”.

Using WordPress plugins to generate static web sites has some limitations. Here’s a great guide.

Here’s my workflow:

I create an Ubuntu VM with WordOPs scripts. I then install gsutil to connect to my gcp bucket after I generate the site’s contents.

I then follow this guide to set up my GCP bucket so it matches the DNS for my domain…

Finally, I want to have CloudFlare manage my SSL and act as a CDN to add extra security and limit the traffic to my bucket further.

Now if I want to make a post, I have multiple levels of security. I would have to VPN into my network to connect to my WordPress VM. I can do this on my phone with the WordPress App. This isolates the wordpress portion.

I can then generate the static site from my vm and push it to my bucket, making it effectively a staging site, separating it from production. I can do the whole process securely from my phone with a SSH client.