Set up localhost on VirtualBox
My local stack includes MAMP, VirtualBox and ModernIE. ModernIE is great for cross-browser testing, but you have configure your "hosts" file. Here are the steps to get localhost working through VirtualBox:
- Click on
settings -> network
- Select
bridged adapter
from the dropdown
- Boot up your virtual machine
- Navigate to
C:\Windows\System32\drivers\etc
- Change permissions. Right click,
Properties -> Security -> Advanced.
SelectUsers
->Change Permissions
. ClickFull Control -> Ok
.
6) Finally, open
hosts
with Notepad
- Enter the IP address of your localhost and the URL
- Save changes
- Open a web browser and type in your address. Your localhost should now resolve.
Ubuntu
For testing on Ubuntu (via VirtualBox), you will need to bridge the network adapter and edit your host file as well. It's much easier than on Windows!
- After bridging the network adapter (like above) open Terminal, and type:
sudo nano /etc/hosts
2) Enter the IP address of your localhost and the URL
- Save the changes ( CTRL + X + Y ) and exit
That's it!
**Note: If your localhost is setup for DHCP, you'll probably need to update the hosts file with your new IP on a regular basis.