I've looked all over for the solution to my problem and cannot find it.
So I have a host machine running virtualbox with multiple web servers. Each VM (webserver) has 2 network adaptors; Nat (with port forwarding for 8080 to 80 and SSH) and host only adaptor. Each Host only adaptor has it’s own network adaptor (so each vm should have it’s own external ip.) Using apache on the host machine I have the following file in the sites-available (one for each server):
<VirtualHost *:80> ProxyPreserveHost On ProxyRequests Off ServerName www.domain1.com ServerAlias domain1.com ProxyPass / http://192.168.58.1:8080/ ProxyPassReverse / http://192.168.58.1:8080/ </VirtualHost>
The idea is that apache on the host system will redirect requests based on the domain name to the correct vm that is hosting that site (then let apache on that server do what it needs to.)
It seems all of my domains point to the same vm. So regardless of what domain I go to it takes me to the exact same page. So I’m wondering what I am doing wrong and how to make the domains point to the correct vm? Does it have to do with the hostnames on the servers not being configured correctly? If it is a hostname issue what/how should I set the hostnames to be?
It seems that apache isn't the problem. It seems that somehow all the host only IPs point to the same VM. So I must be missing some configuration with the host-only adapters on vms even though I made sure that each vm had their own set.
See answer below.