Question:
How can I access Apache server remotely by the public IP?
2013-12-05 06:39:04 UTC
I have Apache 2.2.25 with openssl-0.9.8y running on my PC. The problem is I can't access it remotely by the public IP. The browser keeps saying "The connection was reset". But when I access it from that PC (by the public IP, too), my site loads successfully.

I've add Apache to Windows Firewall exception and forward all ports on it.
I'm using SpeedUp SU8900 and ZTE MF651 USB modem and my ISP is Telkomsel (Indonesia, dynamic IP).

Additional information:
My server name is localhost:80
I'm configured my server to listen 0.0.0.0:80 and listen port 80 & 443

So, how can I access my server remotely by the public IP?
Is there any problem on my configuration?
Do I need to add a rule to "host" file on C:\Windows\System32\drivers\etc?
Four answers:
efflandt
2013-12-05 15:19:36 UTC
Note that if you try to access it with a URL that does not include a specific filename or trailing slash, apache would redirect to its ServerName (localhost in your case), which may be why it works from the same server, but not beyond that. In other words if you try to access it as http://your_public_ip it redirects to http://localhost/, which would reference the client computer itself, not your server.



If that is the problem, you can get around that with "UseCanonicalName Off" directive. See http://httpd.apache.org/docs/current/mod/core.html#usecanonicalname



However, it also depends whether you properly port forwarded port 80 to your server LAN IP through your router and whether your ISP blocks incoming port 80 (many cable companies do). Also many routers do not do loopback (LAN2LAN via WAN IP), so you may need to test if it is publicly available from a computer with some other internet connection, NOT on your LAN. But first make sure that it works from another computer on your LAN using its LAN IP.
2013-12-05 06:53:28 UTC
Try making it listen to a non-standard port like 8888 and see if it works. Your ISP may be blocking port 80. Since you are dynamic, they probably don't expect you to be running a web server.
anto
2013-12-07 01:40:03 UTC
Seems like it doesn't listen on port 443.
2016-03-13 13:25:00 UTC
Ctrl+F5 when you refresh stops using your browsers cache.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...