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 have an Ubuntu Server virtual machine running apache installed on Fedora. How can I forward external web requests to my virtual server?

So I have my host (fedora) running on I have my virtual machine (ubuntu) running on

How can i make it so when someone requests on a separate computer (from their web browser), my host forwards the request to the virtual machine and therefore pages are served from the VM.

share|improve this question
up vote 1 down vote accepted

If the Ubuntu VM is the only publicly available webserver on your LAN, then you can portforward all incoming requests for TCP/80 on your firewall/router to

You have a problem when you need more internal hosts to be publicly available webservers. You need to either get more public IP addresses, or set up the webserver to proxy all requests to different webservers, depending on the Host header of the incoming request.

This is called a reverse-proxy, and is quite easy to setup with Apache. The downside is that the load on the 136 webserver will increase because it proxies all traffic. The upside is that it can serve as a cache as well, reducing the load on the other webservers. Speaking of which...

Another option, similar to the Apache reverse-proxy, is installing a load-balancer, such as Varnish, and portforward your incoming TCP/80 traffic to that load-balancer. In the load-balancer you can define rules to define which requests are handled by which internal servers. In effect this is a reverse-proxy as well, but load-balancers such as Varnish are more advanced in their caching methods and configuration.

share|improve this answer

Unless I am completely misunderstanding your question, just make sure your DNS for the hosted site points at the IP address of the virtual machine, ensure there is no firewall getting in the way and the correct routing is in place.

If that doesn't answer your question, then please elaborate in more detail.

share|improve this answer
I added more info. – Petey B Sep 12 '10 at 18:39
In this case, Martjin's answer is the correct one. – wolfgangsz Sep 12 '10 at 19:28
Something I almost forgot: since your VM runs on a private LAN IP address, your host will also need an IP address on the same LAN, otherwise it cannot route the traffic. The host cannot see the IP address of the VM directly. – wolfgangsz Sep 12 '10 at 22:14

Is the VM's NIC set for NAT by chance? If so, is there a "hard" requirement for it to be NATted? If not, why not just set the VM's NIC to "bridge" mode and assign it a working (for your network) 142.204.x.x address?

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.