简体   繁体   中英

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?

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.

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.

What do you mean "share"? If you've got an apache installation on your main system, you can browse to pages served by that installation.

If you've got a virtual machine with windows XP on it, and its own apache installation, that is a seperate installation. You can do port forwarding to that virtual machine, so you can access that too.

For instance, you can have have Apache 1 (main system) running on port 8112, and Apache 2 (virtual machine) on 8113, etc...

I guess you could put htdocs in a shared virtualbox folder, so you can update site contents from both systems, but they still would be served by seperate apache installs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM