1

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:

  1. Changed some lines at the beginning of /etc/apache2/ports.conf from

    NameVirtualHost *:80
    Listen 80
    

    to

    NameVirtualHost *:8041
    Listen 8041
    
  2. Changed the first line of /etc/apache2/sites-available/default from

    <VirtualHost *:80>
    

    to

    <VirtualHost *:8041>
    
  3. 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 :-/

4
  • If you have another internal device connected your local network.. are you be able to access it using the above said IP with the port??
    – AzkerM
    Apr 27, 2014 at 15:30
  • Yes. I can use e.g. the Windows machine on our local network and point a web browser to 192.168.1.133:8041 and I get the apache2 "It works!" web page. Because of this I wondered if it was a router issue but all I have to do with the router is forward port 8041 to the ubuntu machine, right? And I have a couple of other port-forwarding rules set up (e.g. ssh gets forwarded to the same ubuntu machine) and these work fine.
    – Yannick
    Apr 27, 2014 at 15:33
  • Have a look at the last comment of this > ubuntuforums.org/showthread.php?t=1944290
    – AzkerM
    Apr 27, 2014 at 15:36
  • My ISP reserves the right to change my IP address occasionally, so I don't want to hard-wire any IP address into the set-up. I tried it anyway (editing apache.conf adding what it suggested there, and restarting) and it didn't fix the problem. I think that many things changed with apache2 since 2012 anyway :-/ What frustrates me is that I'm sure there must be a way of debugging the issue -- I get the error "Firefox can't establish a connection to the server at 123.456.78.90:8041." but I now want to look at some log files somewhere, or something, to see exactly what failed.
    – Yannick
    Apr 27, 2014 at 15:58

1 Answer 1

2

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .