MacOS – Trouble accessing the OS X Lion web server from other device

apachemacosweb-sharingwebserver

I'm developing a web app for mobile phones. To easily get a feel of how it is to use, I simply copied the app into ~/Sites (after enabling web sharing in the System Preferences).

Navigating to http://localhost/~username/myapp.html works perfectly. But if I do an ifconfig to get my IP address and navigate to the URL from my iPhone (substituting localhost with the IP address), I get an Error 404. How can I troubleshoot and resolve this issue?

Best Answer

If you put it in the

~/Sites

Folder then you have to navigate to

192.168.0.1/~USERNAME

Where you substitute your IP address and the username that belongs to the ~/Sites folder you copied your web app to.

To get it to just recognize the IP address without the username subfolder put it here:

/Library/Webserver/Documents

EG NOT the library folder in your home folder but the library folder in the root of the hard drive.