Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing local apache server from virtual box

I have apache installed on my machine. And I have windows xp installed on virtual box in the same machine. Can I share apache between them?

like image 748
Selvaraj M A Avatar asked Apr 12 '12 07:04

Selvaraj M A


People also ask

Can you run a server on VirtualBox?

VirtualBox is “free as in beer” proprietary desktop virtualization software from Oracle that runs on Linux, Mac, and Windows. You'll use it to host your 'server' VMs — the targets of your eventual “big software” deployment.


2 Answers

I'm running a virtualbox with w7 on wxp. On the host (wxp) i'm running a local apache install. I can access the host apache install from the guest system using ip 10.0.2.2.

I've added an entry to the guest hosts file (windows/system32/drivers/etc/hosts) pointing the domain i want to test to the ip above. Thus: 10.0.2.2 www.domainname.com

From my guest w7 system i can now access www.domainname.com, which is now served from the local apache on my host system. This works including mysql db support on the host.

I found the ip number in this thread: https://forums.virtualbox.org/viewtopic.php?f=8&t=44068

Hope this helps.

like image 59
user400199 Avatar answered Oct 09 '22 08:10

user400199


yes but you have to configure the network of the XP VM to "Bridge". Then you can access your Apache server on the host machine with the browser on the XP VM (http://192.168.0.24 for example). Both the host and the VM are on the same network then.

like image 20
Philippe Bazard Avatar answered Oct 09 '22 07:10

Philippe Bazard