1 2 Previous Next 18 Replies Latest reply on Sep 14, 2011 4:31 PM by gbullman

    Fusion, Leopard & MAMP - looking for dead easy instructions

    chippper Novice

      I'm struggling with trying to get my MAMP installation to show up under Fusion. Here is my configuration:

       

      Running mac os 10.5.1

      Fusion 1.1.1 - connected using NAT

      Windows - XP sp2

      on a MacBook Pro which connects to a wireless network via airport

       

      What I'm trying to do is to:

      1. Be able to test sites hosted via MAMP in fusion - that is, I have a local wordpress install, and want to test it in IE using Fusion

      2. Be able to test the site from anywhere with my MBP - this computer hops from network to network every day, and sometimes I don't have any connection at all

       

      - I'm not looking to be able to view the test site from another computer - I just want everything contained on my MBP.

       

      I found this thread:

       

      http://communities.vmware.com/message/782477#782477

       

      But got kind of lost. Hence the title of this thread - I'm just looking for a walk through.

       

      I know that it involves editing the hosts file, which is here:

       

      C:\Windows\system32\drivers\etc\hosts

       

      What I'm getting lost with is what to add to the file. Should it list the IP address windows itself is receiving? Right now that is 192.168.113.128. Would I then add:

       

      192.168.113.128    mysites.dev      <--- I made that name up

       

      to the hosts file? then, to access the sites in IE - I would use the url: http://mysites.dev/wordpress (or whatever directory i need)?

       

      I've sort of tried this, but haven't had success.

       

      So, as I indicated, I'm just looking for a step by step process. Any help is greatly appreciated!

        • 1. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
          WoodyZ Guru

          Okay I just tested this so I know it works... here is what I did...

           

          Set the Virtual Machine Network to NAT and disconnected the Host from an active network to simulate not having Internet Connectivity per one of your requirements.

           

          In a Terminal in OS X I typed "ifconfig -a" without the quotes to get the IP Address of "vmnet8" as this in the VMware NAT Adapter on the Host and the address I want to use in the Windows HOST File.

           

          I edited the C:\Windows\system32\drivers\etc\hosts adding the following.

           

          192.168.152.1    test.com www.test.com

           

          Note: Your "vmnet8" IP Address may vary so obviously use yours not mine.

           

          After editing the HOSTS File you must either reboot for the changes to take effect or in a Command Prompt type the following.

           

          ipconfig /flushdns

           

          I was then able from the Virtual Machine in IE's address bar type either of the following addresses and bring up the Mac's Web Server Content.

           

          http://test.com or http://www.test.com

           

          Is this what you wanted?

           

          Anyway I've attached a file named EDITHOSTS.ZIP containing a NT Command Script named EDITHOSTS.CMD.  Place the EDITHOSTS.CMD file in a directory that's in your %PATH% and you can then in a Command Prompt type EDITHOSTS and then press Enter.  It will load the HOSTS file and then Flush the DNS Resolver Cache after you close the HOSTS file and report that the flush was successful or not.  This makes it much easier then manually navigating to the HOSTS file and editing it then rebooting or manually issuing the ipconfig /flushdns command for the changes to take place.

           

          Note:  I used test.com and www.test.com however there is an actual test.com domain and because I've modified the hosts file it does not actually go to the real test.com site but the site as defined by the ip address in the hosts file which was the Apache Server on my MBP.

           

          File Attached: EDITHOSTS.ZIP

           

          • 2. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
            Master

            Hi, Chippper.  Yes, that discussion thread got a little complicated, didn't it?  Not to worry.

             

            For anybody who's new to this issue, here is a quick summary of the problem.  Macs will make up a local name for themselves, such as "joe-cools-computer.local".  Unfortunately, when you run an Apache Web server under Mac OS, it will assume that everybody in the world can use that name.  When a Web browser sends an HTTP request to Apache, it will reply with a redirection message saying, in effect, "Call me back at joe-cools-computer.local".  But no other computer in the world (not even a virtual machine inside this Mac) can use joe-cools-computer.local to find Apache, because that name has no DNS translation.

             

            Just giving your Mac a name with a DNS translation, or putting joe-cools-computer.local into your DNS server, won't be good enough for mobile systems.  If your Mac's primary IP address changes all the time, you'll have to keep updating DNS all the time.  But DNS updates don't propagate instantly.  This is a recipe for frustration.

             

            So here's a solution in two parts:

             

            1.  Make sure that, no matter what happens to your Mac or to your virtual machine, there's an IP address by which your VM can always call your Mac.

            2.  Make sure that your VM associates joe-cools-computer.local (or whatever crazy name your Mac thinks it has) with that IP address.

             

            The secret to part 1 is that virtual machines can have more than one virtual network adapter.  It's just like sticking more than one Ethernet card into a PC: each can have its own IP address and its own network connection. 

             

            To pull this off, edit the virtual machine's Settings while it is powered off.  (Just suspending the virtual machine is not good enough; you actually have to shut down Windows or Linux inside the VM.)  Add a network adapter and place it into host-only mode.  You will leave this new, second network adapter in host-only mode forever.  You can move the primary virtual machine around among the network modes freely, but the purpose of this second adapter is to ensure that the virtual machine can always call the Mac by the IP address the Mac uses on that private, host-only network.

             

            You will need to find out what your Mac thinks its address is on the host-only network.  Open a Terminal window on your Mac and give the command ifconfig vmnet1.  For example:

             

             

            In this example, my Mac's IP address on the host-only network is 172.16.9.1. 

             

            Now to pull off part 2.  You will need to add an entry to the virtual machine's host file that associates that IP address with whatever name your Mac has made up for itself.  To continue our example:

             

            172.16.9.1  joe-cools-computer.local

             

            is what you would want to put into your VM's C:\Windows\system32\drivers\etc\hosts -- assuming, of course, your VM is running Windows.  On a Linux VM, you'd edit /etc/hosts similarly, and also edit /etc/nsswitch.conf to ensure that the local hosts file is consulted for hostname lookup in addition to DNS and the many other supported name-services.

             

            With this done, your Mac's Apache will be able to get away with calling itself joe-cools-computer.local, because your VM will associate that with a name that always resolves to the host Mac.

             

            Tip o' the hat to rcardona2k, who helped me see how useful a second, host-only network adapter for the VM is in this circumstance.

            1 person found this helpful
            • 3. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
              chippper Novice

              Many thanks to both of you!! It's now working... mostly.

               

              I'm not even sure if the issue I'm having is exactly Fusion's fault or not.

               

              Now that MAMP works and I can view files in Fusion, I want to get my wordpress install going. I have it installed locally, and can see it on my mac browser at

               

              localhost:80/wordpress

               

              However, it just flat out refuses to work in Fusion. Using the methods you both suggested, I edited the host file, and other MAMP files work correctly (for instance, my joomla installation). But nothing I do lets me see my wordpress blog in Fusion. I've re-installed WP and MAMP, but I keep getting the error "Internet Explorer cannot display the webpage".

               

              Maybe this is more of a MAMP/Wordpress issue - but I'm stuck scratching my head. I don't know why Fusion would be able to see other MAMP files, but not the wordpress installation.

               

              Any thoughts? You all have been extremely helpful! Thank you!!

              • 4. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                rcardona2k Champion

                You can't access MAMP from XP using localhost because that resolves to 127.0.0.1 meaning your XP system not OS X.  You could redefine localhost by removing it's separate line in hosts and placing it on your line with your 172.* address, e.g.

                 

                172.1.2.3  myOSXcomputer.local localhost

                • 5. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                  WoodyZ Guru

                  Technical Nitpick:  Fusion is a Mac Application that allows you to virtualize different OSes and as such if you're talking about something your doing in, say, Windows you should refer to Windows and not Fusion per-se.  It just make it easier to see the whole picture clearer.

                   

                  Anyway if your using localhost:80/wordpress from IE in Windows unless you modified the default HOSTS entry of 127.0.0.1 localhost in Windows then you are not getting to then Mac as localhost by default is just that the Local Host meaning the system itself and not in the scene of Host OS as in Mac is the Host OS and Windows is the Guest OS.

                   

                  I have Apache running on my MBP in order to work with the websites I maintain and test in IE in Windows and when I modify the HOSTS file so I can use the fully qualified domain name and test the local content before pushing it to the real Web Server I have no problems using the configuration I suggested however I have not used the apps your using and cannot offer anything more that making sure you have things configured right in relegation to the apps your using. (This is why I scripted the EDITHOST.CMD file to make changes on the fly easy.)

                   

                  Maybe you need to look closer at Brian's suggestion as it may work better for what your trying to do then what I suggested.

                   

                  • 6. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                    Master

                    Hey, chippper, I assume that, when you try to hit your wordpress installation from the virtual machine, you're using a URL like http://joe-cools-computer.local/wordpress rather than http://localhost:80/wordpress.  As other posters implied, "localhost" means "this computer", and your virtual machine is not the same computer as your Mac.

                     

                    Other posters showed how you can redefine "localhost", but I personally try to avoid that practice.  I always forget I've done it, and then I get very confused when I try to use localhost for its original purpose ("this computer"), and it doesn't work.  Also, other applications may rely on localhost, not necessarily in user-visible ways.

                     

                    Given that your browser in the virtual machine can hit the Apache install in your Mac, you know that the network configuration is fine.  Now's the time to start using standard Web troubleshooting techniques.

                     

                    • Check Apache server logs

                    • Open a command-line session in the client computer (in this case, the VM), telnet to port 80 on the server, and type HTTP using your fingers (such as GET / HTTP/1.0).

                    • Install a browser plugin such as Firefox's Live HTTP Headers so that you can see what the browser is trying to send

                     

                    • 7. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                      chippper Novice

                      Ach! I see now that my post was misleading. I'm very sorry -

                       

                      I'm not trying to access my site in Fusion via localhost:80. I followed WoodyZ's extremely helpful instructions, and everything worked out great. I edited my hosts file in XP so that it had the IP the terminal command brought up, and I assigned it a different site name. It was something like this:

                       

                      192.abc.e.fgh   mysites.dev

                       

                      Now, I can see my MAMP sites in Fusion when I enter a URL with the appropriate directory:

                       

                      in IE} http://mysites.dev/joomla

                       

                      Works like a charm!

                       

                      What the problem is that Wordpress, and Wordpress alone, just flat out refuses to show up, no matter what I do. I'm just curious if anyone else does any work with Wordpress on here who might have some insight?

                      • 8. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                        fitter man Novice

                        I am trying to do what you suggest (in Part 1, adding a second network adapter) but when I go to the settings, the "" control only allows me to add a shared folder, in Fusion 1.1. I upgraded to 2.0, thinking may that would be different, and in the network adapter setting, it shows mine, but here again, the "" control is disabled. What am I missing?

                        • 9. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                          fitter man Novice

                          Ignore my post. I re-read brianriceca's and realized I hadn't shut down the VM. Duh.

                          • 10. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                            ottosmo Lurker

                            I ran into a similar problem in a different situation, and found a solution.  Not sure chippper if this is relevant but it might be.

                             

                            I am running Fusion under OSX as the host OS and WinXP as guest.  In my case my local Wordpress server is on the XPvm with xampp, more-or-less the reverse of what you describe.  I initially had no connectivity between the VMs until I followed the instructions in this thread to set up a second virtual network adapter. 

                             

                             

                             

                            Anyway, the point is that eventually I did get it set up with entries in the hosts files on both the VM and the OSX side so that http://bloghost (the name I chose) could see the Apache instance, but still Wordpress didn't work.

                             

                             

                             

                            It turned out that there's a setting within Wordpress itself that specifies the base URL of all Wordpress links.  I had to login to Wordpress admin within its native vm, and change that from http://localhost/wordpress to http://bloghost/wordpress.

                             

                             

                             

                            After that Wordpress generated URLs that the OSX side liked, and since I had configured the guest OS to understand the same name in its hosts file, it liked it too.

                            • 11. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                              remoteONE Novice

                              Ok I give up, I need help now ,

                              Ive followed every possible instruction on this and other forums to no avail.

                              I followed this instruction here to-the-letter and same result... no connection to the MAMP web server.

                               

                              I powererd down the WinXP VM and setup the second Host Only network adapter.

                              Got the Mac IP address from terminal.app

                              edited HOST file in XP :

                              #vmnet1: host only mode network adapter
                              192.168.172.1  joe-blows-macbook.local localhost

                              then rebooted.

                              Still no worky... "http://joe-blows-macbook.local/"  nor "http://localhost/"  .. nothing works!

                               

                              edited HOST file again in XP :
                              192.168.172.1  joe-blows-macbook.local

                              then rebooted.

                              Still no worky...  "http://joe-blows-macbook.local/"   nor .. "http://192.168.172.1/" nothing works!

                               

                               

                               

                              1. Now I assume my computers name is correct from the terminal command prompt?

                              ie "Joe-Blows-MacBook:~ blow$ ifconfig vmnet

                              2. The URL box in IE case-shifts the computers name from "http://Joe-Blows-MacBook.local/" to "http://joe-blows-macbook.local/" .

                                 Can I assume its of no consequence

                               

                              Nothing I try works !  Im going out of my brain over this!  Help greatly and humbly appreciated

                              • 12. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                                gbullman Expert

                                Your statement of "and setup the second Host Only network adapter." is confusing me.  This should work with any of the 3 default adapters provided with Fusion (Bridged, NAT, or Host Only), For Bridged the Mac would need to be connected to a network, not sure if NAT will work without a network or not.

                                 

                                What URL do you enter in the Mac's browser to view the MAMP site?

                                 

                                I ended up purchasing MAMP Pro for the Mac because I needed to support more than one site & the restriction of MAMP that it is always localhost is a bit more problematic when you're trying to access it from another computer (physical or virtual).  MAMP Pro makes it easy to give each site a more meaningful name

                                 

                                Another thing to confirm is that MAMP by default listen's on port 8888.  If you did not change that setting in MAMP then in the URL address in the browser on your windows machine should be: http://joe-blows-macbook.local:8888 since you are not using the default http port of 80.

                                 

                                Doing this really should be pretty straight forward, it is just a matter of figuring out what isn't lining up.

                                • 13. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                                  remoteONE Novice

                                  Thanks gbullman,

                                   

                                  RE: MAMP port  8888.
                                  Using the URL http://joe-blows-macbook.local:8888  improves things slightly. I get to view the folder file structure that MAMP is serving:Screen shot 2011-09-14 at 5.04.50 PM.png

                                  But selecting any folder (eg http://joe-blows-macbook.local:8888/3G/) containing the wesite files(index.php and .htaccess etc)  renders no web pages. The site won't load and IE just gives me the "Internet Explorer cannot display the webpage" message.

                                  I dont think I need MAMP pro as all the sites should be accessed the same way as in MAMP  ie. http://joe-blows-macbook.local:8888/store1_folder/ ,http://joe-blows-macbook.local:8888/store2_folder/. But I can see how having Pro could make life easier in this regard.

                                   

                                  RE:  "and setup the second Host Only network adapter."   I mean: "and setup the second  network adapter as Host Only" as reccommended in the setup proceedure in this post. So I have 2 network adapters in vmware for the WinXP VM. One is NAT,  the second, used for MAMP sharing is Host Only.

                                  Cheers

                                  • 14. Re: Fusion, Leopard & MAMP - looking for dead easy instructions
                                    WoodyZ Guru
                                    not sure if NAT will work without a network or not.

                                     

                                    As I said in my first reply, "Set the Virtual Machine Network to NAT and disconnected the Host from an  active network to simulate not having Internet Connectivity per one of  your requirements." to the OP... so, it does work with NAT when not connected to a Physical LAN.

                                    1 2 Previous Next