Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a linux server on configuration with apache. However I cannot get access to it using a remote computer.

I can ssh to the server normally.

my IP table:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --             state RELATED,ESTABLISHED
ACCEPT     icmp --  
ACCEPT     all  --  
ACCEPT     tcp  --             state NEW tcp dpt:22
REJECT     all  --             reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
REJECT     all  --             reject-with icmp-host-prohibited

netstat -ant

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State
tcp        0      0      *                   LISTEN
tcp        0      0       *                   LISTEN
tcp        0      0 SERVERIP:80       *                   LISTEN
tcp        0      0        *                   LISTEN
tcp        0      0      *                   LISTEN
tcp        0      0     *                   LISTEN
tcp        0    196 SERVERIP:22                 MyIP:3149                   ESTABLISHED
tcp        0      0 :::111                      :::*                        LISTEN
tcp        0      0 :::22                       :::*                        LISTEN
tcp        0      0 :::47193                    :::*                        LISTEN

using Curl SERVERIP:80 and curl localhost:80, both return default page from apache.

What could be the problem?

share|improve this question
up vote 11 down vote accepted

You need to enable access to your server on port 80 as it is currently being blocked by iptables.

sudo /sbin/iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT

This will insert the rule into your iptables configuration at the start. Once you have done this and tested that it works then you should save the configuration so that it it is used next time the service starts,

sudo /sbin/service iptables save

this will write the current configuration to /etc/sysconfig/iptables.

share|improve this answer

Your iptables rules only allow incoming connections on port 22. Open up port 80 as well.

share|improve this answer
...and the cmd is iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT – onik Aug 17 '11 at 9:11
...which is correct, but won't work, because it will append this rule behind the one which REJECTs all incoming connections not ACCEPTed earlier. – Paweł Brodacki Aug 17 '11 at 9:17
That's true, I'm just used to adding it to the rules file into the correct position, forgot to mention. iptables -D FORWARD -j REJECT --reject-with icmp-host-prohibited, then the previous, then add the deny-all catchrule with iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited – onik Aug 17 '11 at 9:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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