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:
- Get your VM IP address
- 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“.
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:
Save it and go to the desired URL. Voilà!
Let’s lookup the new subdomain and see what we get:
All looks good. That’s all.
We’re finally done. In this short series I showed you
- Starting a WordPress blog on Google Compute Engine
- Using a Cloud SQL database
- Configuring your blog to use Google Storage
- 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.