How to allow other computers on the network to access my virtual web server?

I use Windows 7 as a host OS. I have Debian 6.0.4 installed on VirtualBox with lighttpd.

I can easily access the web server from my machine by typing http://localhost in the browser address panel but other computers from my network cannot access it by typing my IP address.

I use NAT port forwarding in VirtualBox. What should I do to make my web server available for everyone on my network ?

EDIT:

I have came to a 'solution' - I have to set guest port and host port to different ones. But I still have problems with this, namely:

server is launched on port 8080.

Port forwarding : guest port 8080
                  host port 80

I can access the server form my machine both on

  • http://localhost
  • http://localhost:8080

But I can only access the server from other machines on the network by IP:8080


One option is to change the network adaptor of the virtual machine to bridged mode; you should then be able to access the virtual server from the other machines on the network, by providing your guest's IP address.

Edit:

For practical aspects, look at the VirtualBox documentation on Virtual networking. Your options are to use bridged networking

With bridged networking, VirtualBox uses a device driver on your host system that filters data from your physical network adapter. This driver is therefore called a "net filter" driver. This allows VirtualBox to intercept data from the physical network and inject data into it, effectively creating a new network interface in software. When a guest is using such a new software interface, it looks to the host system as though the guest were physically connected to the interface using a network cable: the host can send data to the guest through that interface and receive data from it. This means that you can set up routing or bridging between the guest and the rest of your network.

or port forwarding:

As the virtual machine is connected to a private network internal to VirtualBox and invisible to the host, network services on the guest are not accessible to the host machine or to other computers on the same network. However, like a physical router, VirtualBox can make selected services available to the world outside the guest through port forwarding. This means that VirtualBox listens to certain ports on the host and resends all packets which arrive there to the guest, on the same or a different port.

So, in case of a NAT port forwarding, you should use the following command:

VBoxManage modifyvm "VM name" --natpf1 "guesthttp,tcp,,80,,80"

Ok, I have solved this, after few hours of digging in the Internet.

The problem was my IM communicator spik which was listening on port 80. After turning it off and rebooting the machine everything works like charm :)

I have read that one might have the same issue with e.g. Skype.