Step 1: Install and Start Nginx on Node-02
First, connect to Node-02 via SSH and install Nginx:Step 2: Update the DNS Zone File on Node-01
Next, log into Node-01 to update the DNS zone file with a new CNAME record. In this example, setting up a record for “www” means that accessing www.my.kodekloudlab.com will point to my.kodekloudlab.com. Remember to update the serial number in the SOA record whenever you modify the zone file. Open the zone file using your preferred editor:Step 3: Update the Nameserver Configuration
After editing the zone file, update your nameserver configuration. Editing the resolv.conf file ensures that the correct nameserver entry is in place. For instance, in a KodeKloud playground the file might initially look like this:Always back up configuration files before making changes to ensure you can roll back if necessary.
Step 4: Testing the CNAME Record
Now, test the configuration by curling the service via the CNAME:Additional Consideration: Amazon Route 53 and CNAME Records
A unique characteristic of Amazon Route 53 is that it supports alias records for CNAMEs. This means you can point directly to AWS resources like S3 buckets or Elastic Load Balancers—even at the apex of a domain—a feature not supported by traditional CNAME records.