无法从远程访问端口80,但在本地工作?

我有一个Linux服务器configuration与Apache。 但是,我无法使用远程计算机访问它。

我可以正常的SSH服务器。

我的IP表:

Chain INPUT (policy ACCEPT) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT) target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 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 0.0.0.0:3306 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 SERVERIP:80 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:45117 0.0.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 

使用curl localhost:80 Curl SERVERIP:80curl localhost:80 ,都从apache返回默认页面。

可能是什么问题呢?

您需要启用对端口80上的服务器的访问,因为它目前被iptables阻止。

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

这将在开始时将规则插入到你的iptablesconfiguration中。 一旦你完成了这一点,并testing它的工作原理,那么你应该保存configuration,以便它在下次服务启动时使用,

 sudo /sbin/service iptables save 

这会将当前configuration写入/etc/sysconfig/iptables

你的iptables规则只允许端口22上的传入连接。打开端口80也是如此。