When I run apache on port 80 it works fine. But if I change the port then it's accepting connection from localhost only. Somebody please help me figure out what is the problem.

My iptables -L result

Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:1032

Chain FORWARD (policy ACCEPT) target prot opt source destination

Chain OUTPUT (policy ACCEPT) target prot opt source destination

  • Show a iptables -L – Mike Oct 5 '13 at 12:35
  • Show us your Listen statement(s). – Iain Oct 5 '13 at 13:15
  • @lainNameVirtualHost *:1032 Listen 1032 Inside my /etc/apache2/ports.conf – Muneer MK Oct 5 '13 at 13:36
  • If i change 1032 to 80 inside my /etc/apache2/ports.conf and /etc/apache2/sites-available/default then it works smooth.. – Muneer MK Oct 5 '13 at 13:42
  • Are you running on a server infrastructure that you manage yourself, or a VPS/dedicated server hosted by someone else for you? – jgoldschrafe Oct 5 '13 at 13:44

On Amazon EC2, your instance has a security group attached that functions as an external firewall. If you view your instance properties through the AWS console, you should be able to easily determine which security group is in effect on your node. You'll need to add a firewall exclusion in that security group (see "Security Groups" under "Network & Security" in the left-hand navigation bar) in order to allow access to that port from outside the instance.


I would suggest trying to first flush the firewall rules as follows:

iptables -F

And if that doesn't work, try disabling Ubuntu's uncomplicated firewall:

sudo ufw disable
  • Thanks for your response.. I have tried both and still the same. – Muneer MK Oct 5 '13 at 12:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.