1

I am trying to setup a simple web server, and have installed a LAMP package to get started (Apache 2.4). I have a simple index.php page that provides current server stats. I am able to access it internally from my network (192.168.1.200), but am unable to access it from my network's public IP address (71.46.83.4) despite forwarding ports 80 and 8080 on my router.

I have tried configuring my listening ports in apache2.conf, which is set to Listen 80 and Listen 8080. I've also tried setting up my iptables, although I feel that's not doing anything since they are all open by default (at least I think, correct me if I'm wrong). My iptables are as follows:

Chain INPUT (policy ACCEPT)
target  prot opt source      destination
ACCEPT  tcp  --  anywhere    anywhere    tcp dpt:http
ACCEPT  all  --  anywhere    anywhere    ctstate RELATED,ESTABLISHED
ACCEPT  tcp  --  anywhere    anywhere    tcp dpt:ssh
ACCEPT  tcp  --  anywhere    anywhere    tcp dpt:http-alt

Chain FORWARD (policy ACCEPT)
target  prot opt source      destination

Chain OUTPUT (policy ACCEPT)
target  prot opt source      destination

This is the result of netstat -ntl:

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address    Foreign Address  State
tcp        0      0 127.0.0.1:3306   0.0.0.0:*        LISTEN
tcp6       0      0 :::8080          :::*             LISTEN
tcp6       0      0 :::80            :::*             LISTEN
tcp6       0      0 :::13124         :::*             LISTEN

I am a Linux Novice. I would be happy to provide debug information. Thanks in advance!

2 Answers 2

1

Your ISP, Brighthouse, may very well block traffic addressed to port 80 and 8080.

Try forwarding non-standard ports, like 12345 or 23456, to your internal address port 80. Maybe your router cannot redirect ports, so then reconfigure your Apache config to then use the same non-standard port. Then try accessing your server from an external computer.

Your router and/or modem may have trouble doing hairpin routing as well.

You might be better off getting a free micro instance from Amazon if you want to tinker with web servers. You can also get free servers from MS on Azure as well.

3
  • No dice. I forwarded port 13124, set Apache to listen on 13124, and added 13124 to my iptables. Intranet access via port 13124 works fine, but no external access available. :(
    – Maxattax
    Sep 13, 2015 at 23:49
  • As a diagnostic step try disabling the firewall on your linux box. I trust that your router and server can ping each other, and that your linux box has internet access--it can download things and so forth from the internet.
    – Darren
    Sep 14, 2015 at 0:08
  • I flushed my iptables and am still not having success. Yes, I have been able to retrieve packages and ping between my router and linux box. I am beginning to wonder if I have set up my network correctly, and if for some reason the packets are not even being forwarded to my machine from the router, despite being told to do so. Is there some way I could test this?
    – Maxattax
    Sep 14, 2015 at 0:28
0

The first thing you need to do is try connecting from another network using your IP address, connecting from the same network using a public IP will not work, try using your phones 3g network if that makes sense. From your response it seems you have correctly configured the /etc/apache2/ports.conf and your virtual host file as it is serving the pages locally, @darren may be right that at time the isp or router manufacturer use port 80 and 8080 to access the management interface and that may not work, you will need to set port forwarding and it should work. Just tested it on my virtual box. You will need to open up the port in your firewall though.

You must log in to answer this question.

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