Search code examples
azurednsnameserversazure-virtual-network

Subdomain not working after changing the nameservers


I have hosted my website in Microsoft Azure. I have purchased the domain from register.com.

I have used a Linux VM for my project deployment.

Suppose my website name is example.com. I have created a sub domain for it called app.example.com

It was working fine but its not working when i created a DNS Zone resource in my azure account & updated those nameserver name in my register.com site.


Solution

  • According to your description, we can follow those steps to setup Azure DNS zone and your domain name:
    1. Add record set via azure portal, point to your Azure VM: enter image description here

    2.Add NS record to register.com, like this:

    Host: web.jasonye.com  
    Record type:     NS record  
    Value:    ns1-01.azure-dns.com 
    

    After a few mins, we can use nslookup to verify name resoution is working or not:

    nslookup -type=SOA jasonye.com
    

    The following is an example response from the preceding command:

    C:\Users>nslookup -type=SOA jasonye.com
    Server:  UnKnown
    Address:  2404:f801:10:12e:fe::2
    
    Non-authoritative answer:
    jasonye.com
            primary name server = ns1-01.azure-dns.com
            responsible mail addr = azuredns-hostmaster.microsoft.com
            serial  = 1
            refresh = 3600 (1 hour)
            retry   = 300 (5 mins)
            expire  = 2419200 (28 days)
            default TTL = 300 (5 mins)
    
    ns1-01.azure-dns.com    internet address = 40.90.4.1
    

    After that, we can access this web via IE: enter image description here

    More information about Azure DNS zone, please check this link.

    Each registrar has their own DNS management tools to change the name server records for a domain. In the registrar's DNS management page, edit the NS records and replace the NS records with the ones Azure DNS created.