Accessing VM's Web server from host OS
Enable port forwarding under the default NAT adapter
Pass through the port you want to access (guest) 80 to the port you want to access it on (host) 80
- VirtualBox > Settings > Network > Adapter 1 > Advanced > Port Forwarding
- Give the rule a name
- The left number is public (host port)
- The right number is private (guest port)
In my case I have apache2 running on a Ubuntu guest and have forwarded, so windows:80 routes to ubuntu:80
This method should work with any host & guest OS on any port running any service
Related videos on Youtube
olp
Updated on September 18, 2022Comments
-
olp over 1 year
I'm running OS X on my computer, and I installed Windows 10 with VirtualBox. On Windows, I'm developing a server, which I can access (on Windows) by
http://localhost:8080/
.Now, I need to access it from OS X (with a Java application, but it doesn't matter), and that's the problem. How can I access Windows VM localhost from OS X (with Safari for instance) ?
(I made research during several hours, I tried bridged access, private host, etc. I did not manage to solve my problem.)
-
davidbaumann over 5 yearsThat's ok, but he also has to check whether the port is listening on localhost only.