Accessing Website Being Hosted on Virtual Machine

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
devarishi
Forum Contributor
Posts: 101
Joined: Fri Feb 05, 2010 7:15 pm

Accessing Website Being Hosted on Virtual Machine

Post by devarishi »

Hi,


I want to access the Website / Web Pages being hosted on the Virtual Machine (Linux) created with Sun VirtualBox onmy Host OS (Windows XP).

The website is working fine on the VM. But I can't access it from the Host OS (Windows XP).

What settings to do I need to configure to accomplish it?

Besides, how can I access the website, being hosted on the Host OS, from within the VM?

What settings to do I need to configure to accomplish it too?

Thanks!
Doug G
Forum Contributor
Posts: 282
Joined: Sun Sep 09, 2007 6:27 pm

Re: Accessing Website Being Hosted on Virtual Machine

Post by Doug G »

One way, I set up a bridged network so the VM is just another IP on my existing network. I did this on a linux host but I imagine a windows host would be much the same.
devarishi
Forum Contributor
Posts: 101
Joined: Fri Feb 05, 2010 7:15 pm

Re: Accessing Website Being Hosted on Virtual Machine

Post by devarishi »

Doug G wrote:One way, I set up a bridged network so the VM is just another IP on my existing network. I did this on a linux host but I imagine a windows host would be much the same.

I also setup a Bridged Network on Windows XP, the Host OS. I attached this Bridged Network to the VM so that I can ping it from the Windows box. I am able to ping and ssh the VM (Linux Box).

But I am not able to access the website running on the VM. Did you do any settings in some files on the Linux Box?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Accessing Website Being Hosted on Virtual Machine

Post by Weirdan »

You should be able to access it using ip in the url, like this: http://192.168.2.12
If you use apache virtual host (it's not the same as 'virtual machine', mind you), you may need to add the name for the host into c:\windows\system32\drivers\etc\hosts if you want to access web server running inside the virtual machine, and put a name into /etc/hosts if you want to access webserver running on the host from within a virtual machine.
devarishi
Forum Contributor
Posts: 101
Joined: Fri Feb 05, 2010 7:15 pm

Re: Accessing Website Being Hosted on Virtual Machine

Post by devarishi »

Weirdan wrote:You should be able to access it using ip in the url, like this: http://192.168.2.12
If you use apache virtual host (it's not the same as 'virtual machine', mind you), you may need to add the name for the host into c:\windows\system32\drivers\etc\hosts if you want to access web server running inside the virtual machine, and put a name into /etc/hosts if you want to access webserver running on the host from within a virtual machine.
You have showed me a very interesting thing:

Code: Select all

c:\windows\system32\drivers\etc\hosts
I never knew that etc\hosts would be found under Windows also.

I was able to ping the VM using its IP but not by its host name. I made an entry in the above file and voila!

Well, I also enabled "Secure Web Server (HTTPS)", "Telnet", and "FTP" service in Firewall to flag them as a Trusted Services.

Now I can browse the website on the Host OS. :drunk:

Okay, I have done similar settings in Firewall on the Windows Box also. And now I can access the website running on IIS within the VM.

So, the problem of accessing website from VM on Host OS and vice versa is resolved!

Thanks! :drunk:
Post Reply