I want to access VirtualBox's localhost using a smartphone for me to see how the website looks like in a phone.
- Host OS - Windows 7 Pro
- Guest OS - Ubuntu 16.0.4 LTS
- SmartPhones' OS - Android and iOS
You actually shouldn't need this, most browsers have a "responsive design view mode" which you can activate by pressing F12 to activate the developer console and clicking on the mobile phone/tablet icon on the left of it.
But to answer your question, yes, this can be done through port forwarding.
At this point, you can access your server on your host machine by typing in localhost:8080.
To open it on your phone, connect the phone and the computer on the same network (such as a WiFi hotspot). Determine the local IP address of your computer with
ipconfig /all. For example, if the IP is
192.168.1.1, type in
192.168.1.1:8080 on your phone.