Ubuntu – Portforwarding from host to guest using port 80, but it doesn’t work

Apache2servervirtualbox

I installed ubuntu server inside a virtual box(11.04), then i configured apache.

Inside virtual box setting, i made a port forwarding from port 80(host) to 80(guest), i open my web browser on my host, and i go to http://localhost DON'T work, but if i go to http://localhost:1080, it work, but i didn't make a port forwarding from 1080 to 80, i have no 1080 in my configuration, what i want to know is why it does this?

I know that port 80 won't work until i launch the virtualbox as root, but what i don't know is why does it actually transform the port 80 to 1080 when it could just not work… is there something in virtualbox that see when its not root and transform address below 1024 to something else?

Best Answer

  • The VirtualBox manual says:

    Forwarding host ports < 1024 impossible:

    On Unix-based hosts (e.g. Linux, Solaris, Mac OS X) it is not possible to bind to ports below 1024 from applications that are not run by root. As a result, if you try to configure such a port forwarding, the VM will refuse to start.

    I guess this is the reason for getting port 80 forwarded properly when the host was run as a root user. Anyway I am not sure why the port is changing automatically from 80 to 1080.