NodeJS, Nginx, domain name not resolving without www.

September 21, 2019 102 views
Nginx Node.js

Hi guys,

So I have a domain name registered as luckynote.io. I’ve been working with this domain for a month now let’s say, and today when I ran my droplet I could not access the server through this domain. However, if I try with www.luckynote.io I can access the server, but I can’t figure out why it won’t work with the A record (luckynote.io).

I have Nginx installed and configured and I am serving a MERN app on the server. I’ve also been running sudo nginx -t, and all the nginx files seem to be in order The Nginx server-block for luckynote.io is as follows:

server {
    listen 80;
    listen [::]:80;
    server_name luckynote.io www.luckynote.io;
    location {
        proxy_pass http://localhost:3000;
    }
} 

I’ve also made the soft link between this server block and the sites-enabled directory.

Any help would be gladly appreciated.

4 Answers

Hi @ivanssardelic,

I see the domain luckynote.io is resolving now, can you please confirm what was the issue? Was it a root Cname record or was it something else?

Kind regards,
Kalin

Hey @KFerdinandov,

Yeah, it is working now. I was trying yesterday and it wasn’t working and after your answer I checked and it worked. I didn’t change anything. I was working with droplet snapshots, and perhaps it took more time (much more) to revert to the earlier state.

Still, it shouldn’t be breaking out of nothing. Hopefully, it won’t happen again.

Thanks for the reply, and I’ll post here again if it happens again.

Cheers,

Ivan

Hey @KFerdinandov

Again luckynote.io is not resolving, while www.luckynote.io is resolving. Have no clue why this is happening.

Cheers,

Ivan

Turns out it’s a local issue with Chrome. For some reason, Chrome will not resolve luckynote.io on my machine.

Thanks for your time and effort @KFerdinandov!

Cheers mate!

Have another answer? Share your knowledge.