Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've looked all over for the solution to my problem and cannot find it.

Setup:

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.)

Problem:

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?

Update:

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.

Solved:

See answer below.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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