Apache 2.4 Webserver not Publicly Accessible

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

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

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like