Page 1 of 1

How to access web server running on a VM

Posted: 10. Apr 2011, 20:56
by hammerhead1024
Greetings,

Not sure if this is the proper forum for this. I have VirtualBox installed on a Windows 7 Pro host. I created a VM and installed Linux CentOS on it. I want to use it as a web server so I installed Apache httpd. I tested it by starting Firefox browser on the CentOS, entered http://127.0.0.1, and the test page popped up. I tried to access it from another PC on my home lan by specifying the IP address for the Linux system (10.0.2.15) but it wouldn’t connect.

To verify it wasn’t something with my router I started Windows web server software (IIS) on the Windows 7 and on another PC specified the IP address of the Windows 7 PC and the IIS test page did pop up.

So what do I have to do to access the Linux web server from another PC?

Thanks.

Re: How to access web server running on a VM

Posted: 10. Apr 2011, 21:03
by Perryg
You should read chapter 6 of your VirtualBox users guide. Pay particular attention to the port forwarding section when using NAT.

Re: How to access web server running on a VM

Posted: 12. Apr 2011, 16:06
by oszone
But is there away to connect to guest os' web server by IP? so I could set hostname for it?

Re: How to access web server running on a VM

Posted: 12. Apr 2011, 16:09
by Perryg
Yes.
Select Bridged if there is a router in the network or host-only if there is not for the #1 adapter.
Add #2 adapter and set it to NAT if using host-only and you need Internet access in the guest.

Re: How to access web server running on a VM

Posted: 12. Apr 2011, 21:42
by oszone
When I choose host only, there is nothing to select in "Name" section and ai cannot save.

Re: How to access web server running on a VM

Posted: 12. Apr 2011, 21:55
by hammerhead1024
Perryg wrote:You should read chapter 6 of your VirtualBox users guide. Pay particular attention to the port forwarding section when using NAT.
Thanks much for pointing me to the right doc. I entered this command in a host's DOS window:

Code: Select all

"c:\program files\oracle\virtualbox\vboxmanage" modifyvm "LinuxSys1" --natpf1 "guestweb,tcp,,2222,,80"
Booted the VM and was able to access the guest web server from a host browser with address: http://127.0.0.1:2222

Re: How to access web server running on a VM

Posted: 13. Apr 2011, 14:52
by manikaedore
I think you can just use to set the NAT on using host-only. This could have an access on web server. It needs some other settings on the server to do that and accessing through IP address.