I am trying to use nginx as a proxy for load balancing 2 servers. I don't know the best practices here, but this is the scenario:
- official.domain.com (the hostname resolve the nginx ip)
- app1.domain.com (the server number one of the app)
- app2.domain.com (the server number two of the app)
Since only the official domain will be public, the others two are "private", I don't want a user or a search engine will see these domains so I was thinking of modifying the /etc/hosts
and force the 2 ips on the two hostnames. I did it on the nginx container and on the host too, but without success. Nginx is telling me that it cannot resolves app1.domain.com
I know that if I create a public hostname on the domain for app1 and app2 this should work, but I want to tell nginx to resolve locally these domain.
Edit
the output of getent hosts app1.domain.com
or on app2.domain.com
either on the container or the hosts is the same. With the correct ip. Both are resolving correctly now, but just because I add the ip on the public domain but now I have Bad Gateway
0 Answers