Search code examples
nginxnginx-upstreams

Can Nginx automatically update the upstream servers details without Nginx reload


I am seeing nginx upstream as follows

upstream entities {
    server entities.qa.local:8888;
}
upstream workflow {
    server workflow.qa.local:9999;
}

Some times server went down and up on its own at that time their internal ips will get change. After that nginx will not update with new IP until we reload the Nginx.

Can we update those ips without Nginx reload?


Solution

  • I found a trick on this article, you can try to add the resolver and store your URL in a variable. Nginx will use DNS in this resolver when calculating the variable. This article: https://docs.wallarm.com/admin-en/configure-dynamic-dns-resolution-nginx/