Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up a virtual machine host (currently running ubuntu + KVM) which will host a number of VMs for different applications. For example, we have a wiki running on one VM and a web application running on another.

     /  \ 
    VM1 VM2

Internally, the VMs live on their own virtual network with their own IPs, however externally, there is only one IP address which is the IP address of the host.

There is a domain set up on our network that points to the Host's IP and I can set up an iprule to forward traffic destined for the host directly to one of the VMs. However, in order to make both VMs accessible to the outside world, somehow I need to forward requests based on the URL.

Ideally I'd like to forward requests by subdomain e.g. -> host -> VM1 -> host -> VM2

but alternatively by the URL path:

http://host/vm1 -> host -> VM1
http://host/vm2 -> host -> VM2

I have already installed Apache on the Host machine. What kind of forwarding/redirecting/aliasing/reverse-proxying rules would I need to get this kind of network setup to work? Is there anything extra needed to handle subdomains?

share|improve this question

Are you serving any webpages from the Host itself? If not, and all of the web data is on VM1 and VM2, then probably Apache on the Host is not the best solution. Most likely you should use something like haproxy or squid on the host to forward the requests to Apache running on VM1&2

share|improve this answer
No, Host itself is not serving anything at the moment but I will definitely look into those proxy tools as an alternative to Apache. – Alex Spurling Jul 28 '09 at 22:29
+1 for the proxy. Even web servers like lighttpd/nginx provide a proxy mode that works well in this situation. – sybreon Jul 29 '09 at 4:05

I have somewhat similar environment, where I need to forward stuff from one host to another, so I use Apache's mod_proxy I hope that helps, you can also utilize Virtual Host

share|improve this answer

I think using Apache on the host is fine. This is basically the same situation as this serverfault post, you want some sort of reverse proxy.

share|improve this answer

Your Answer


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.