WordPress blog under a (sub) domain on Google Compute Engine

Once your WordPress blog is up and running on a GCE it’s time to show this to the world. It would work just as it is now – only on the IP address but it doesn’t look good. I’ll show you how to put in under a (sub)domain in just few step which shouldn’t take longer than 2 minutes.

Publishing under a subdomain

What we’re going to do is to publish our blog under a subdomain (same as this blog) and you can do thin in just 2 simple steps:

  1. Get your VM IP address
  2. Add a new “A” record for you domain

Get your VM IP address

First you need to know your blog IP address. It’s easy to find in GCP console. Go to “Compute Engine -> VM Instances” and you’ll see all your instances with their IP addresses. We’re interested in the VM’s “External IP“.

Compute Engine instance external IP

Setting your domain “A” record

The second and last step is to set your domain “A” record to point to your IP. According to dnsimple.com an “A” record is:

An A record maps a domain name to the IP address (IPv4) of the computer hosting the domain. Simply put, an A record is used to find the IP address of a computer connected to the internet from a name.

The A in A record stands for Address. Whenever you visit a web site, send an email, connect to Twitter or Facebook or do almost anything on the Internet, the address you enter is a series of words connected with dots.

Simply said it translated your domain address into an IP.

(For this post’s purpose I’ll set my blog to run on http://gcp.tunarob.com/.)
Now go to your domain provider and add a new “A” record. In my case it’d be:

Add a domain "A" record for your blog

Save it and go to the desired URL. Voilà!

Let’s lookup the new subdomain and see what we get:

Domain "A" record lookup

All looks good. That’s all.

Summary

We’re finally done. In this short series I showed you

  1. Starting a WordPress blog on Google Compute Engine
  2. Using a Cloud SQL database
  3. Configuring your blog to use Google Storage
  4. and finally, how to put it under a subdomain.

All the described steps are exactly the same as what I’ve done to start this blog. I hope it will be helpful and no one else will have to struggle and will find out that running WordPress on GCP is not so bad and complicated.

Now I’m planning to focus more on things that I do on daily basis – Python, Docker, Django etc. So stay tuned.

Related Post


One thought on “WordPress blog under a (sub) domain on Google Compute Engine

Leave a Reply

Your email address will not be published. Required fields are marked *