Accessing localhost sites in MAMP server from IE on Parallels

Discussion in 'Windows Guest OS Discussion' started by Sean Delaney, May 3, 2009.

  1. Sean Delaney

    Sean Delaney

    Messages:
    1
    I have Parallels running Windows XP with IE7 and MAMP setup on my MacBook.

    I have 2 local test websites setup on MAMP and working fine. I can access them by:

    http://localhost/
    http://test-site/

    I have not configured Parallels yet as I don't know how to do it or what I need to change...

    However I do have this done to get my local sites working in MAMP:

    In the httpd.conf file I have:

    <VirtualHost *>
    DocumentRoot "/Applications/MAMP/htdocs"
    ServerName localhost
    <Directory /Applications/MAMP/htdocs/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>

    <VirtualHost *>
    DocumentRoot "/Applications/MAMP/test-site/htdocs"
    ServerName test-site
    <Directory /Applications/MAMP/test-site/htdocs/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>

    In the /etc/hosts/ file I have:

    #
    # Host Database
    #
    # localhost is used to configure the loopback interface
    # when the system is booting. Do not change this entry.
    ##
    127.0.0.1 localhost test-site
    255.255.255.255 broadcasthost
    ::1 localhost
    fe80::1%lo0 localhost


    Basically I want to be able to view my test websites (http://localhost/ & http://test-site/) in IE7 on Parallels.

    Please advise?

    Regards

    Sean
     
  2. Todd Nienkerk

    Todd Nienkerk

    Messages:
    1
    Same problem!

    I'm having the exact same problem. I am also tracking this post on Experts Exchange, though it's not entirely helpful.
     
  3. MarcusB

    MarcusB

    Messages:
    1
    It's pretty easy:

    First you've got to find out the IP-address of your Mac (System Preferences / Network)
    There are two entries:
    Parallels Shared Networking Adapter and
    Parallels Host-Only Networking Adapter
    Choose the IP-address according to your Parallels Guest Network Settings
    Edit your Windows hosts-file (C:\WINDOWS\system32\drivers\etc\host - initially this file is read only, so make it editiable by right-click/Properties, uncheck read-only) like you did with the Mac hosts-file, but this time using the IP-address you just found out.

    Imagine that your Guest-OS is running on another machine, which is connected to your Mac via Ethernet in a local network. This way the setup ist pretty obvious.

    PS: @Sean: you should change your virtual host 'localhost' to something more specific, cause this name is reserved for the loopback-device, be it on Mac or on Windows
     
  4. tsheiner

    tsheiner

    Messages:
    6
    @MarcusB

    Thanks! Your instructions worked fine.

    It took me a bunch of googling to find this post--I am surprised this is such a buried issue as I imagine many people want to use Parallels to test sites developed locally on host machine.

    Tim
     
  5. FattyMatty

    FattyMatty

    Messages:
    3
    Thanks for the help - almost there

    Great info - thanks! But for some reason I'm still not able to access the individual sites I have set up on my mac.

    If I type in a domain I have set up on my mac - for example http://dev.localsite.com - I get the main hosting page on my mac, but it doesn't seem to read the Virtual Host (httpd.conf) to go to the actual directory for the individual site.

    To explain - here's what I'm using:

    So in this case, if I type in http://dev.localsite.com it loads /Users/matthew/Sites but not /Users/matthew/Sites/clients/localsite.com. Any thoughts on what I'm doing wrong?

    Thanks.
     
  6. FattyMatty

    FattyMatty

    Messages:
    3
    OK. After some more poking around I figured it out. Changed it to this and it now works.

    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot /Users/matthew/Sites
    </VirtualHost>

    <VirtualHost *:80>
    ServerName dev.localsite.com
    DocumentRoot /Users/matthew/Sites/clients/localsite.com
    </VirtualHost>

    Figured I'd mention in case anyone else was having the same problem.
     
  7. ATE Design

    ATE Design

    Messages:
    5
    Same issue.

    I have been down so many roads on this.

    I'm using Drupal and am able to access the directory listing over Parallels 4.

    But can't seem to get it to display the site accross!

    I want to use Parallels for IE browser compatibility and its very frustrating not being able to get this to work!

    I've tried using Bonjour as well. Which should make this very simple. I even downloaded the Bonjour SDK to see if there was a means to use that to port it over.

    Help, Suggestions or better yet an APP from Parallels would be greatly appreciated.

    This use of Paralels is obviously common, but thus far the knowledge base to utilise it is leading me in circles.

    Help, suggestions, comments. Anything would be useful!

    Cheers.
     
  8. ATE Design

    ATE Design

    Messages:
    5
    Where did you make this change? Also I currently have my sites in Vhosts pointed at a SVN system I am keen not to alter.

    NameVirtualHost *:80

    <VirtualHost *:80>
    ServerName 127.0.0.1
    DocumentRoot /Users/matthew/Sites
    </VirtualHost>

    <VirtualHost *:80>
    ServerName dev.localsite.com
    DocumentRoot /Users/matthew/Sites/clients/localsite.com
    </VirtualHost>


    Where is this change made and where else did you have to change things? Did you change anything on the Windows Machine as well. I saw a post advocating changing Windows etc. file. But this only seems to substitute localhost for the IP. It still isn't delivering e.g. libbyeverall.localhost:8080 or the windows equivalent.

    But oddly it is allowing me to access my basic Localhost site. at http://xx.xxx.x.xx:8082/ Any suggestions. Or could you possibly write back your solution.

    This seems to be a fairly common issue. I have come accross loads of requests for this but no successful solutions.

    If you can help I'd appreciate it. Its getting pretty frustrating to say the least.
     
  9. alev

    alev Parallels Developers

    Messages:
    287
    Hello, ATE Design!

    It looks like you want to use DNS names.
    Parallels VM is just like another machine in network (type of connection defined by network adapter type (Shared/Bridged/Host-only)). To resolve the site's IP by name like dev.yoursite.com you need either register this site using DynDNS (global network) or installing DNS at computer in your local network (your Mac for instance).

    Check this link for more info: http://forum.mamp.info/viewtopic.php?f=2&t=8201
     
  10. FattyMatty

    FattyMatty

    Messages:
    3
    ATE Designs - I made changes in 3 places. Say you want to create a virtual host named:

    http://dev.localsite.com

    (I use the "dev" just to designate local versions so it's easy to bounce back and forth between www and dev. Some folks would prefer to look at http://www.localsite.local but whatever floats your boat...)

    1. The changes I mentioned above were to create the virtual host on your mac's apache installation. You make those changes in the httpd-vhosts.conf file which can be found here by default:

    /private/etc/apache2/extra/httpd-vhosts.conf

    Note: make sure that this line is uncommented in your httpd.conf file as well or the virtual hosts file won't be included:

    Include /private/etc/apache2/extra/httpd-vhosts.conf

    That file is here by default: /private/etc/apache2/httpd.conf


    2. The hosts file on your mac needs to direct the domain you want to you use to your virtual domain. This gets it to work on your mac. Should look like this:

    You'll find that file here:

    /private/etc/hosts


    3. The hosts file on your Parallels virtual machine needs to be updated with the IP that Parallels uses to talk to your mac. See MarcusB's instructions above - you can find your IP in the Parallels Guest Network Settings in the Mac Network Preferences Pane.

    On my MacBook, Parallels is using the IP 10.211.55.2 so my hosts file looks like this:

    As MarcusB mentioned, that file is here: C:\WINDOWS\system32\drivers\etc\host and you can edit it with NotePad.
     
  11. KaiDavis

    KaiDavis

    Messages:
    1
  12. Chacapamac

    Chacapamac Bit Poster

    Messages:
    18
    I’m trying to do exactly that. I have Mamp installed and multiple site in a specific server that are available on my mac (mountain lion)
    The url is —> http://localhost:8888/MySitesContainingFolder/WhateverSiteFolder/

    IF I follow the Quote...
    1— Find your IP Adress System Preferences / Network — Easy to do :)

    2— There are two entries: Parallels Desktop / Preferences / Advanced
    Parallels Shared Networking Adapter and
    Parallels Host-Only Networking Adapter
    Choose the IP-address according to your Parallels Guest Network Settings

    Oups, Wen I look at those settings, I’m not to sure what to change as you have multiple entry in those 2 tabs.....?

    Screen Shot 2013-05-28 at 9.05.23 AM.jpg

    What do you want me to change???
     
  13. Chacapamac

    Chacapamac Bit Poster

    Messages:
    18
    FORGET ALL THIS

    THIS IS THE WAY

    1— Install Bonjour for Windows... on your Virtual Machine
    a) Download and install (in your Windows OS) Apple’s Bonjour For Windows at http://support.apple.com/kb/DL999
    b) Or install Safari or iTunes in your Virtual Machine (you will have a choice to install Bonjour for Windows) (and better, it will be updated with your apps)

    2— Enable file sharing...
    - Now back in Mac OSX, enable file sharing. System Preferences > Sharing > File Sharing. (tick File Sharing)

    3— Change your Apache and MySQL ports in MAMP...
    - Run MAMP and open up ‘Preferences’. Change the Apache Port to 80 and the MySQL Port to 3306
    Note: N.B. Make sure there are no other instances of MySQL running.

    4— Check your computer Sharing Name
    System Preferences > Sharing > File Sharing
    sharing-name.jpg

    Access your site/sites with that type of url....

    Example: http://Whatever-Name.local/htdocsubfolder/foldersites/

    This example show my particular setup

    Part 1 —> http://
    Part 2—> Whatever-Name.local = Your own computer sharing name (follow by .local)
    Part 3—> /htdocsubfolder = In my case I have a subfolder that contain all my tests sites...
    Part 4—>/foldersites/ = The name of any test site folder...

    Boum! No Crap!

    Remember that your local url in your mac will now be like this:
    http://localhost/htdocsubfolder/foldersites/
     
    Last edited: May 30, 2013

Share This Page