Super User is a question and answer site for computer enthusiasts and power users. 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 have an Ubuntu 10.10 host on which I installed VirtualBox VM. In VirtualBox, I have installed two other Ubuntu machines mainly with the same configuration. I am trying to achieve a High Availability cluster with two nodes (those 2 virtual machines) and I don't want to mix my Host machine in this project.

Now, I want to switch Apache service among those 2 virtual machines and for that I created a virtual host. I edit on both machines /etc/apache2/sites-available/mywebsite and add the following lines:

 DocumentRoot /var/www/mywebsite/

This will give me the option to launch my website from instead of http://localhost. But, this only works in my 2 nodes cluster and is not visible from my host machine. What can I do? Is there any solution ?

I am sorry for the long post, but I wanted to give you as many details as possible. Thanks

share|improve this question
the correct lines that I changed are:<VirtualHost> ServerAdmin ServerName DocumentRoot /var/www/truenature/ </VirtualHost> – florin Mar 7 '11 at 9:37
up vote 0 down vote accepted

What you need is a load balancer. The load balancer uses a watchdog to monitor the availability of the real servers and sends the requests to the one which is alive.


You have two options: Either the clients need to connect to another computer which forwards the requests to the running server (= load balancer) or you have to move the IP address when you switch servers.

You can assign several IP addresses to the same computer. I suggest to assign two: One which never changes (for remote administration) and one which you assign when you start apache on this host (that would be in your case).

The alternative is to start Apache only on a single host and let the load balancer monitor this fact. Clients always connect to the load balancer. As long as only a single Apache service runs, the load balancer will always send all requests to just a single machine.

To assign an additional IP address, use this command:

ifconfig eth0:1

The ":1" says "additional address for eth0" (more information).

share|improve this answer
Hi again. what I want to achieve is failover IP not load balancing. I want to switch the apache service from one node to another in the cluster that I set up using heartbeat + pacemaker. The problem is, my cluster has 2 nodes (2 virtual machines). And apache works but I only can lunch the website from either one of the virtual machines, and I want to be able to lunch the website from the host machine. – florin Mar 7 '11 at 10:28

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.