I have a little strange case.
I configured two servers in AWS: Develop and QA, the two with Ubuntu 16.04, Apache 2 and PHP 7.0. I created a website en Develop, and configured its VirtualHost file. So, in Develop I edit its /etc/hosts file to point to itself:
127.0.0.1 site.test.com
And, in QA, I edit its /etc/hosts file to poinut to Develop private ip.
172.x.x.x site.test.com
And, if I test with elinks in Develop and QA, I can acces to the site without problem in both cases.
Now, in my local Windows computer, if I put the Public IP from Develop Server in mi chrome, it shows me the Apache default page. You know, that page with the text "It works! This is the default welcome page used to test the correct operation of the Apache2..."
So, I edited my local hosts files from my computer, pointing my site to Develop Public IP:
x.x.x.x site.test.com
But, when I tried to access site.test.com in my chrome, it thow me a HTTP ERROR 502.
I can acces to Develop server by SSH by its public ip, and I can see the Apache default page, but I can´t see the sites I configured in it. But, internally between the two servers in AWS, I can.
What I am doing wrong? Did I misunderstand something?