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 /
   ProxyPassReverse /

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.


I ended up solving this by using only one host-only adapter instead multiple adapters and then just using different ports for each VM. This way each VM had the same external IP just different ports. I also set static IP's on each VM which I'm not entirely sure if it was necessary. After I did that I just updated each of the Apache configs on the host machine for the new IP and ports.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.