NGINX configuration to redirect call correctly

Hello to all,
I have a problem with the configuration of Nginx and Rancher … I hope someone can help me …
Basically I can not reach the container using the public “name” but only using the private ip and the port that I have configured.
I think it’s a problem of NGINX configuration but I do not understand where the problem is … Everything is redirected to the rancher …

My structure is as follows:

Virtual Machine 1 (with Public IP)
Docker with 2 containers:
NGINX and Rancher (with Load balancer (to redirect the various calls to the correct container))

Virtual Machine 2
Docker with:

  • Rancher Agent
  • All the containers I need set up with correct VIRTUAL_HOST and with correctly configured DNS records (example: container1 -> cont1. XXX .com, container2 -> cont2. XXX .com)

Nginx Configuration File: https://pastebin.com/jkd2UTUi

Thanks so much!