Accessing Passenger sites from a Vista instance in VMware Fusion

This article by Robby Russell reminded me of a hopefully helpful post I’ve been meaning to write for a while. The problem is straightforward: You’ve got Phusion Passenger set up on your Mac OS X Leopard (see Robby’s post for details). Your client called, and they say the site you just launched for them looks funky in Internet Explorer. Fun. So now, you want to access your local Passenger site living at http://myapp.local from the copy of Windows Vista living in your VMware Fusion.

There are two things you need to do in order to access your Passenger sites from Windows Vista via VMware Fusion:

  1. Figure out what Vista thinks is your Mac’s IP address
  2. Create entries in Vista’s /etc/hosts file (yes, Vista actually has one)

So fire up VMware and Vista, and let’s begin:

Determine Vista’s Gateway IP

When running VMware Fusion, the virtualized OS (in our case Vista) refers to the host system (Mac OS X Leopard) as its IP Gateway and its DNS. So you want to figure out what that IP address is, and you’ll be able to access the Apache server running in Leopard. Determine the IP with the following steps:

  1. Open the Control Panel, switch to Classic View, open Network and Sharing Center.
  2. Click on Manage Network Connections in the sidebar.
  3. Double click on the Local Area Connection, and click on the Details button.
  4. Make note of the IPv4 Default Gateway – that’s your ticket to accessing your Passenger sites.

Finding the Gateway

Edit Vista’s /etc/hosts file

I discovered this handy link, which tells you all you want to know about Vista’s hosts file. In short, it works pretty much the same as any Unix /etc/hosts file. I followed the instructions to set up a shortcut on my Vista Desktop for quick access, and the screenshot of the Properties dialog for that shortcut is below:

Editing the hosts file

Now, just edit the file, creating an entry for each Passenger site:

172.16.160.2 site1.local
172.16.160.2 site2.local
172.16.160.2 site3.local

With the file saved, you should be able to access your Passenger sites from a browser in Vista (no restart of anything needed).

Multiple IEs

Now for a bit of a bonus, I highly recommend installing IETester in Vista. IE8 beta 2, IE7, IE6 and IE5.5 will be at your fingertips.

Find this helpful? Please consider recommending me on Working with Rails.

blog comments powered by Disqus