setting up apache2 webserver -- differences between behaviour within my intranet and outside
I am new to apache2. I have an ubuntu 12.04.4 LTS machine in my home, and just installed apache2 on it. I wanted to set up a webserver running on a port other than port 80 (my router uses port 80). Here's what I did:
-
Changed some lines at the beginning of
/etc/apache2/ports.conf
fromNameVirtualHost *:80 Listen 80
to
NameVirtualHost *:8041 Listen 8041
-
Changed the first line of
/etc/apache2/sites-available/default
from<VirtualHost *:80>
to
<VirtualHost *:8041>
Restarted apache2
My ubuntu machine has local IP address 192.168.1.133, and from any computer on my home intranet if I point a web browser to http://192.168.1.133:8041
then I get the standard apache2 "It works!" web page. I also set up my router to port forward any incoming TCP
packets on port 8041 to the ubuntu machine (still on port 8041).
Let's say my ISP has given me the IP address 123.456.78.90. If I am outside my intranet and I point a web browser to http://123.456.78.90:8041
then again it works.
However, within my intranet (on the ubuntu machine itself or on other machines on the intranet), when I point a web browser to http://123.456.78.90:8041
I get an "unable to connect" error.
Where do I go from here? I am now unclear about whether this is an issue with my apache set-up or my router. I have now unfortunately realised though that it is probably not a question about Ubuntu :-/
The issue above is actually expected behaviour. I need to upgrade my router to one that supports "loopback NAT" a.k.a. "hairpin nat". See here for example.