Filing under: not very interesting but very useful (I hope) tutorials, here’s a step-by-step guide to accessing your local server (ex. the one you’ve got running on localhost:3000).
Why might you need this?
Because you need to test on IE and you have a not-Windows machine. Cool? Moving on.
Getting the VM
Download your VM for the OS/IE combination you need from the VMs page of modern.ie. This tutorial uses VirtualBox which is (hooray!) free to use.
Update the hosts file so you can access your local server
Step 1: Open Notepad as an administrator:
Image may be NSFW.
Clik here to view.
Step 2: Confirm scary security box
Image may be NSFW.
Clik here to view.
Step 3: Open the hosts file
Choose “Open” and find the hosts file. It’s at C:\Windows\System32\drivers\etc. Be sure to “show all” file endings, as you won’t see the hosts file otherwise (it doesn’t end in .txt!)
Image may be NSFW.
Clik here to view.
Step 4: Edit the hosts file to at 10.0.2.2 with some name
Don’t name it localhost because weird things will happen. And don’t forget that you still need to put the port when you’re accessing your server, mysite.com won’t work in your VM, but mysite.com:3000 will if that’s the port for your local server.
Image may be NSFW.
Clik here to view.
Where’s 10.0.2.2 come from? Using the command prompt, you can run ipconfig to see your external host is 10.0.2.2 (or something different if this tutorial didn’t work at this point).
Image may be NSFW.
Clik here to view.
5. Take a snapshot of your machine
Save your machine state. Run your VM from this snapshot to lock it in time when you had this set up, which should also prevent the VM self-combust clock from running (the Windows licenses are only good for so long).
Image may be NSFW.
Clik here to view.
Hope this helps others! Shoutout to my colleague Dave for reminding me how to get this done a while ago, and now there’s a blog post for everyone else to benefit Image may be NSFW.
Clik here to view.
The post Accessing your local environment from a Windows VM (tutorial) appeared first on Pam The Webivore.