What’s the easiest way to access local websites from a Parallels / VMWare Fusion virtual Windows machine?
networking, virtual-machine
Solution
This should be pretty straight forward (for non-subdomained Rails apps). It definitely gets more complicated with subdomains.
Non-Subdomained App
From your Mac terminal:
`ifconfig -a`
Copy the assigned IP address (e.g., 192.168.1.100)
Switch to Parallels, open IE and enter the IP address in the address bar. Don't forget to add the protocol and port number of the running Rails app. For example:
`http://192.168.1.100:3000`
Voilà! Rails app.
Subdomained App
You should probably already be using something like `lvh.me` to ease the burden of creating subdomained applications locally (see ASCIICasts 221: Subdomains in Rails 3). It doesn't seem to be so straight-forward on Windows though.
Edit the Windows `hosts` file. It should be located somewhere like `C:\WINDOWS\system32\drivers\etc\hosts`
Assuming your IP address is the same as above, add a line that looks similar to this, and save:
`192.168.1.100 lvh.me sub1.lvh.me sub2.lvh.me ... subN.lvh.me`
Where sub1, sub2, ..., subN are the subdomains that you want to access from IE.
You should now be able to access `http://sub1.lvh.me:3000` from IE.
A Final Note
I was getting pretty tired of looking up my DHCP allocated IP address every time, so I created a new Network location in OS X called Home that uses DHCP with a manually assigned IP address. That way, I can at least save some time when I'm working from home. Just remember to switch locations when you join a different network. YMMV :)
Problem
- Develop a Rails app on your Mac. - Have a virtual Windows box using Parallels (on the same computer). - Want to test it in IE… - …without deploying it to staging - …or attempting to run your Rails environment within Windows Is there any way to conveniently access port 3000 on my Mac from within Windows?