1
votes

I'm having an issue with my domain name routing setup. I can get "example.com" to resolve correctly from the browser but, I cannot get "www.example.com" to resolve. I have read the docs for my related tech and it all seems to be set up correctly (well I still need to set up HTTPS / TLS but this will come after I can get www.example.com to resolve).

I have an AWS EC2 instance (Ubuntu 16.04.3 LTS) with an elastic IP address associated with it. I also have a domain name on GoDaddy.

My web stack uses Nginx to serve a JS frontend framework and reverse proxying to a Django API.

In AWS console / Route53 I have the following:

  1. A record with name "example.com" pointing to my elastic IP 11.22.33.44
  2. NS record with name "example.com"
  3. SOA record with name "example.com"
  4. Another A record with name "www.example.com" pointing to my elastic IP 11.22.33.44

On my server I have the following server block for my Nginx config

server {
  listen 80;
  server_name example.com www.example.com;

  location = /favicon.ico { access_log off; log_not_found off; }
  location /static/ {
     root /home/myproject/frontend/dist;
  }

  location /api/ {
    include proxy_params;
    proxy_pass http://unix:/home/myproject/backend/webapp/webapp.sock;
  }

  location / {
    root /home/myproject/frontend/dist;
    try_files $uri $uri/ /home/myproject/frontend/dist/index.html;
  }
}

I'm sure I'm doing something dumb but, I cannot seem to figure it out. Appreciate any guidance.

1
Well did you go to something like mxtoolbox.com/dnslookup.aspx to see if the domain name and www domain name resolve to the correct IPs?Shawn C.
Interestingly, yes, it does. However, the dang www.mydomain.com still does not resolve. Thanks for the link though. I didn't know that service existed.SciGuyMcQ
Could be local DNS cache. Try a lookup from kloth.net/services/dig.phpRodrigo M
www.mydomain.com still does not resolve. from where? Your local machine? Did you try doing a nslookup or dig from a terminal?Shawn C.
Ok, so deciphering the suggestions here. I have used the kloth service to dig the www.mydomain.com domains against each of my 4 NS servers and all come back with the NOERROR and answer section with 300 status IN A and correct IP address of my server. Is this not what I would want to see?SciGuyMcQ

1 Answers

1
votes

Route 53 sometimes has a hard time with this, and will only use the first entry found for different A records with the same destination IP.

Instead of creating an additional A record pointing www.example.com to your server's IP(#4), try creating a CNAME record for www.example.com pointing to example.com.