Nginx domain resolution 502 gateway

Francis Daly francis at daoine.org
Sun Sep 29 08:40:58 UTC 2019


On Wed, Sep 25, 2019 at 06:06:16AM -0400, medievil19 wrote:

Hi there,

> At the moment, even though the host file is changed and a local cmd ping
> brings up our server, i get a 502 gateway error nginx in the browser,
> checking nginx error logs i believe it's because nginx server is trying to
> resolve the 3rd party real host IP address but my machine is set to resolve
> the server ip version.

If your nginx config file uses hostnames in the form

  proxy_pass http://$variable;

then nginx needs to use a run-time resolver to find the IP address. That
will probably not use the local hosts file, even indirectly.

If your nginx config uses hostnames in the form

  proxy_pass http://www.example.com;

then nginx will use the system resolver at startup to find the IP address.
That will probably use the local hosts file.

I confess that from your mail, I am not sure what machines are involved
in your system, and how you want them to interact. So I can't say exactly
what should be changed, where.

But hopefully the above will help you work out what needs doing.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list