0

I havent been able to find a solution to my particular problem.

I have a MAC which I set up as a web server and configured my router to forward to the local IP. When trying to access my site from outside, it does say "It works!", however, when I call a simple Hello World PHP script that I have, I am getting an error that the page could not be opened. I did enable PHP on my machine so thats not the problem.

I really have no idea how can I access - I followed so many tutorials and did everything correctly. My router is a Linksys WRT160N if it matters at all. In the port forwarding section, I selected to forward

TommyG
  • 103
  • 3
  • Check the server logs for any relevant errors. The error you described is not helpful in debugging the problem. What do you get if you try to telnet to the server IP/port? Also, can you retrieve the same page locally? – Khaled Nov 11 '11 at 13:54
  • how do i get a server log? i am a total newbie with this. and yes, when i am on the local network (WiFi), i can run the PHP script. – TommyG Nov 11 '11 at 13:57
  • Does it work with the internal IP? – SpacemanSpiff Nov 11 '11 at 13:57
  • what do you mean internal IP? thats the setup - when I am on the local network (via WiFi), i can access this: http://192.168.1.102/ and http://192.168.1.102/hello.php from all my devices (2 MAcs and one iphone). when i go outside, i can access this: http://192.168.1.102/ but not this: http://192.168.1.102/hello.php – TommyG Nov 11 '11 at 14:00
  • possible duplicate of [Loopback to forwarded Public IP address from local network - Hairpin NAT](http://serverfault.com/questions/55611/loopback-to-forwarded-public-ip-address-from-local-network-hairpin-nat) – MadHatter Dec 16 '13 at 12:54

3 Answers3

1

If you are outside of your network you won't be able to access 192.168.1.102. 192.168. is an IP subnet specifically reserved for routers and other internal networks, that IP cannot be accessed outside of your home network.

One solution you could try is using a firewall to target traffic to the computer with the IP 192.168.1.102, then when you try to access your server externally you use the IP of your network, you can find it using something like http://www.whatsmyip.org/

billy bob
  • 11
  • 1
  • Well billy ! wget -O - http://www.ip-details.com/ | grep 'Your IP is' | sed -e 's/.* is //' -e 's/ .*//' –  Dec 16 '13 at 12:06
1

that isn't your external IP (192.168.1.102), this is an internal network IP. anything starting with 192.168.. is relative to your local netowrk. go to www.ipchicken.com to get your external IP, then try that IP with hello.php.

this should work if IP forwarding is working correctly with your router set up.

Robert Van Sant
  • 259
  • 2
  • 6
1

Most routers won't NAT if your requests comes from the inside interface.

So you type in the outside IP and it won't get translated back to the inside IP if you do this from a PC in your own network.

Joris
  • 11
  • 1