0

I have a hostname like this: https://abc.xyz.com

I want to force resolve the dns everytime a request arrives, because if the dns of abc.xyz.com changes i want nginx to still be able to proxy to the site, therefore need to resolve the dns again.

Now i followed this post How to force nginx to resolve DNS (of a dynamic hostname) everytime when doing proxy_pass? and my configuration looks like this

server { ... resolver abc.xyz.com; set $backend "http://abc.xyz.com"; proxy_pass $backend; ... } 

And i get this error [error] 9#9 recv() failed (111: connection refused) while resolving, resolver: <some-dns>:53

I don't understand what i'm doing wrong here, i guess it has something to do with the resolver. The only difference is that the guy in the post put dns there 127.0.0.1. I don't think i want to do that since dns/ip can change when i redploy my app and i saw you can give resolver a hostname but it doesn't work and i get this error.

Any help would be appreatiated!

1 Answer 1

0

The resolver tells which DNS recursive server is used to resolve the domain name. You need to point it to your DNS server's IP address.

4
  • so if im understanding correcty, my application is not the dns server? and i need to figure out my dns-server's hostname (like dns-server.dns.com) or their dns( im assuming their dns doesnt change)? Commented Dec 6, 2021 at 17:45
  • You need to add your DNS resolver's IP address to the directive. Commented Dec 6, 2021 at 18:19
  • do you know where/how do I find that? sorry if its obvious and im stupid Commented Dec 6, 2021 at 18:42
  • You need to ask your hosting provider what are their DNS addresses. Commented Dec 6, 2021 at 22:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.