How to tell where issue is between nameserver and reverse proxy?

December 21, 2018 216 views
DNS Ubuntu 18.04 Nginx

I can publicly access the page i’d like to serve through my droplet IP at port 5000, but can’t reach it with my domain?

A “dig +trace www.mydomain.com” command gets responses from the DigitalOcean nameservers but nothing past that.

I have 3 NS records directing from my domain (@) to ns1.digitalocean.com, ns2.digitalocean.com, ns3.digitalocean.com.
I have 2 A records saying hostnames * and @ will direct to my droplet IP.
I have 1 CNAME record saying ‘www’ hostname is an alias of ’@’.
These were created weeks ago, it seems like they would be propagated by now.

I’m wondering if there’s something missing in my nginx configuration.

If my nginx config block looks like:

http{
...
server {
   listen 80;
   server name mydomain.com www.mydomain.com;
   location / {
       proxy_pass              http://0.0.0.0:5000;
       proxy_set_header   Host $host;
       proxy_set_header   X-Real-IP $remote_addr;
       proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header   X-Forwarded-Host $server_name;
   }
}
}

is there anything else that is necessary to serve the page at my domain?

1 Answer

Hello,

As long as you have both of your www and your non-www versions pointing to your Droplet’s IP address it should work as expected.

Your Nginx looks correct, there’s only one thing that I’ve noticed which might be causing the issue, you need to change:

   server name mydomain.com www.mydomain.com;

To:

   server_name mydomain.com www.mydomain.com;

Note the missing underscore. Then run a config test with nginx -t and if you get Syntax OK message, restart Nginx.

Regards,
Bobby

Have another answer? Share your knowledge.