Accessing MAMP Pro Virtual Host from Intranet

I recently setup a virtual host on MAMP Pro installation. As you all probably know that you can setup a virtual host on your own preferred port. For example, I setup a virtual host named develop on port 8004. so then i can access this virtual host on my mac using this url :

http://develop:8004

The problem raise when i want to access this virtual host from an intranet. I use Windows XP via parallels in this case. The ‘XP Box’ connected to my mac via shared connection and assigned it’s IP address by DHCP. The DHCP assigned IP address of ‘XP Box’ to 10.211.55.12

From this i can figured that (this maybe differ on your installation):

  • Mac NAT Address is 10.211.55.1
  • Mac (the MAMP Pro installed on) IP address is 10.211.55.2
  • Windows XP IP address is 10.211.55.2

I can access MAMP Pro base host on http://10.211.55.2 but it failed when i want to access the develop virtual host. I’ve tried http://10.211.55.2:8004 and http://develop:8004 and both fails.

I found the solution that i have to edit this file:

C:WINDOWS system32 drivers etc hosts

This is the host file of Windows XP. I have to tell this machine that ‘develop’ domain is on 10.211.55.2 . So then this machine can figure out http://develop:8004

127.0.0.1 localhost

10.211.55.2 develop

Backup the hosts file, and then save the changed above.

Now i can access my virtual host on my XP Box via http://develop:8004 . Hope it helps somebody.

Thanks.

php code test block

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

<?php
    $foo = array(1, 3, 7);
    $v = 0;
    foreach ($foo as $fo) {
        $v = $v + $fo;
    }
    echo $v;

Subscribe to RSS Feed Follow me on Twitter!