Question

I have created a few websites locally on my mac using MAMP PRO as my local server environment.

I can access these on my mac as I have the opion of adding a local domain (in MAMP PRO) using "local name resolution"

But... I don't know how to access my sites from my iphone which I need to do to test.

If I put my local IP in (on my iphone) I get the MAMP holding page:

The virtual host was set up successfully.

If you can see this page, your new virtual host was set up successfully. Now, web contents can be added and this placeholder page1 should be replaced or deleted.

Server name: localhost Document-Root: /Applications/MAMP/htdocs

So I know that works but how do I access my indevidual sites.

The location and structure of my sites are like this:

/Users/myusername/Sites/vhosts/site1/public_html
/Users/myusername/Sites/vhosts/site2/public_html
/Users/myusername/Sites/vhosts/site3/public_html
/Users/myusername/Sites/vhosts/site4/public_html

Could this be to do with the localhost Document-Root? I noticed it was /Applications/MAMP/htdocs

Should I change that or change the location of my sites to be in /Applications/MAMP/htdocs?

Thanks C

UPDATE:

Ok, so I changed my Document-Root to /Users/myusername/Sites/vhosts/ which now allows me to load the site localy in my browser with 192.168.1.134/site1/public_html

BUT.. when I load 192.168.1.134/site1/public_html from my iphone (on the same wifi network) I get the page title but the page doesn't load. Just hangs!

Was it helpful?

Solution 2

MAMP has launched an app where you can see your local websites on your mobile through their app MAMP Viewer: https://itunes.apple.com/de/app/mamp-viewer/id1047237620?l=en&mt=8

You just configure the host that you want to use for MAMP Viewer: Select the host you want to view on MAMP Viewer > On General tab, make sure to check, "for 'MAMP Viewer' (LAN only)" > click save > restart your servers > open the app and check your sites.

OTHER TIPS

I use ngrok to forward my localhost and would recommend it. After installing it (it's free), you essentially run something like "ngrok 80" and ngrok will create a public URL that can be accessed from anywhere (AKA your phone) and displays the same content that http://localhost/ would.

Apologies I can't post full http:// links- I'm limited by my reputation.

In your example, ngrok might create a domain "hs673gs.ngrok.com" that corresponds to "localhost" when accessed from your local machine. Going to "hs673gs.ngrok.com/site1/public_html" from your iPhone will be essentially the same as visiting "192.168.1.134/site1/public_html" on your local machine.

Hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top