I'm trying to run two Ubuntu VM's on one machine, each running a separate LAMP stack serving different websites.

Is it possible to use Virtual Hosting to accomplish this? I've read that it's possible, but everything I see involves either the same machine. Can I use multiple machines (virtual or logical). Can I add Virtual Hosting entries without hurting the existing stacks?

Each server functions properly separately.

  • 3
    What do you need virtual hosting for? This is explicitly intended for running different web sites on the same server. If they're already on different servers, what more could you possibly need? – Michael Hampton Apr 21 '15 at 2:09
  • Both machines have the same external IP. If I point two domains at this IP traffic from both will go to only one website. I want to point two domains at two virtual machines on the same external IP address. – Justin Grimes Apr 21 '15 at 3:57
  • It is not possible for two machines to have the same external IP. VirtualHosts are like multiple people living in the same building and receiving mail normally. Your configuration is like having multiple buildings with the same address. – Esa Jokinen Apr 21 '15 at 4:08

You can reach your objective with reverse proxying. It works like this:

You assign the external IP to one of your virtual machines.

In that virtual machine's Apache, you set up a virtual host, which reverse proxies all requests to the second virtual machine, via the internal VM network that both virtual machines are in.

The second virtual machine does not have an external IP address.

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.