How To Configure A Domain for WordPress on Google Cloud

How To Configure A Domain for WordPress on Google Cloud
3 0
Read Time:3 Minute, 57 Second

Domain Name Configuration for WordPress on Google Cloud

After you’ve installed WordPress you have to follow a few spates to Configure A Domain for WordPress on Google Cloud. Let’s Starts To Configure A Domain for WordPress on Google Cloud.

Registering a Domain Name

Before starting this tutorial, you should’ve already purchased a domain name. Most .com domains usually sell for around ten U.S. dollars. However, less commonly used domain names, such as those ending in .club or .site, sell for much cheaper. To register a domain:

  1. Visit a domain name provider (we recommend Name Cheap).
  2. Search for the domain you want to purchase.
  3. Add it to your cart.
  4. Checkout.

Once you’ve registered a domain name and have setup WordPress on Google Cloud (Click-to-Deploy or Bitnami), you’re ready to start this tutorial.

There are 5 steps in this tutorial:

  • Enable the Cloud DNS API
  • Create a Cloud DNS Zone
  • Add DNS Records
  • Configure NS Records
  • Edit Wp-Config.php
  •  

1. Enable the Cloud DNS API

Enable the Cloud DNS API

Login to your Google Cloud Platform account. Click the hamburger menu in the upper left-hand corner of the screen and go to the API Manager > Dashboard.
API Manager
 Once you’ve reached your API Dashboard, click on “ENABLE API” at the top of the screen.
ENABLE API
In the search field, search for “cloud DNS”, and click on “Google Cloud DNS API”. After you’ve clicked on “Google Cloud DNS API”, click enable.

2. Create a Cloud DNS Zone
Cloud DNS Zone

After enabling the Cloud DNS API, click on the hamburger menu in the upper left-hand corner of the screen and navigate to Networking > Cloud DNS.

CREATE ZONE
 Once you’ve navigated to Cloud DNS, click on “CREATE ZONE” at the top of the page.

Enter the name of your website in the Zone Name field, and your website’s root domain name in the DNS Name field. Click the “Create” button.
DNS Name field

3. Add DNS Records

Add DNS Records
After you’ve created your zone, click on the “ADD RECORD SET” link that appears on the next page.
The first record
The first record you’ll create is an “A” record. In the Resource Record Type field, select “A”. In the IPv4 Address field, enter your IPv4 address (instructions for finding your IPv4 address in the next image).
External IP
 You can locate your IPv4 address by clicking on the hamburger menu in the upper left-hand corner of the screen, and navigating to Compute Engine > VM Instances > External IP.
CNAME record
 Next, you’re going to create a CNAME record. In the DNS Name field enter “www”. In the Resource Record Type field enter “CNAME”. In the Canonical Name field, enter your domain name.

4. Configure NS Records

In this section of the tutorial, you will be pointing your domain name to your website on Google Cloud. In this example, NameCheap is used as the domain name provider, however, the process will be similar for all domain name providers.

Copy the four NS records.
After you’ve configured your “A” and “CNAME” records, you should have a total of 4 recordsets. The two-record sets in the middle (NS and SOA) are generated automatically. Copy the four NS records.
Sign-in to the domain name provider where you registered your domain name.
Click on the manage button next to your domain name.
Change NAME SERVERS
In the NAME SERVERS section of the domain management page, choose “Custom DNS”, then paste the four Google NS records.

5. Edit Wp-Config.php

Use the following instructions if you’re configuring the Bitnami version of WordPress on Google Cloud.

VM Instances

From your Google Cloud Platform dashboard navigate to “Compute Engine” >  “VM Instances”.

SSH
Once inside of your Compute Engine, click on the SSH button to connect to your WordPress installation.
wp-config
 Once connected via SSH, connect as a root user and open your wp-config.php file in the nano editor

sudo -i
nano /opt/bitnami/apps/wordpress/htdocs/wp-config.php

Inside of your wp-config.php file, you will need to replace your SiteURL and HomeURL definitions as shown below.

REPLACE THIS:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/'); 
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/'); 

WITH: 
define('WP_HOME','http://example.com'); 
define('WP_SITEURL','http://example.com');

 

Remember to replace “example.com” with either the www. or non-www. a version of your domain name – whichever you prefer. For example:

define('WP_SITEURL', 'http://www.yourdomain.com/');
define('WP_HOME', 'http://www.yourdomain.com/');

 

If you’ve already configured SSL for your domain, you should substitute the http:// in the code above for https:// instead. For example:

define('WP_SITEURL', 'https://www.yourdomain.com/');
define('WP_HOME', 'https://www.yourdomain.com/');

 

That’s it!

Happy
Happy
100 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %

Leave a Reply

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