【问题标题】:Port 80 open on server but cannot connect to it80 端口在服务器上打开,但无法连接到它
【发布时间】:2014-07-19 09:24:05
【问题描述】:

我有一个问题,我一直在尝试解决,但无法弄清楚发生了什么。我有各种网络服务器,它们都安装了 apache。他们都在同一个网络上,但其中一个给我带来了问题。

我有服务器(.44、.45 和 .46)

我可以 ssh 进入 .44 并 ping .45 和 .46 没有问题。但是,当我尝试测试并查看端口 80 是否打开时,.45 会给我这个消息。

 someadminuser@somelocation:/var/www$ telnet 10.0.0.45 80
 Trying 10.0.0.45...
 telnet: Unable to connect to remote host: Connection refused

这是 .46 上的相同测试

 someadminuser@somelocation:/var/www$ telnet 10.0.0.46 80
 Trying 10.0.0.46...
 Connected to 10.0.0.46.
 Escape character is '^]'.

所以我 ssh 进入 .45 以查看端口。

 someadminuser@somelocation:~$ netstat -tulpn | grep :80
 (No info could be read for "-p": geteuid()=1000 but you should be root.)
 tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN


 someadminuser@somelocation:~$ sudo iptables -L
 Chain INPUT (policy ACCEPT)
 target     prot opt source               destination          
 ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:httpflags: 
 ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
 ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
 ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
 ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http

任何帮助将不胜感激。

****************更新****************

我保存了我的 ipv4 表,这就是我得到的:

 # Generated by iptables-save v1.4.12 on Thu May 29 14:05:31 2014
 *nat
 :PREROUTING ACCEPT [3416:231940]
 :INPUT ACCEPT [1175:75880]
 :OUTPUT ACCEPT [337:25196]
 :POSTROUTING ACCEPT [337:25196]
 -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3000
 -A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3000

当然,还有更多内容,但这部分看起来很可疑。

【问题讨论】:

    标签: apache http tcp ssh port


    【解决方案1】:

    所以服务器正在将连接到本地端口 80 重定向到本地端口 3000。大概没有任何东西在端口 3000 上进行侦听,这就是您看到“连接被拒绝”的原因。

    如果工作服务器没有此配置,那么您需要删除(或修复)iptables。如果其他服务器确实有,那么您需要弄清楚它们在端口 3000 上运行了什么以及为什么失败的服务器没有相同的。

    【讨论】:

      猜你喜欢
      • 2017-04-20
      • 2018-11-24
      • 2018-05-04
      • 2017-12-22
      • 1970-01-01
      • 2019-11-05
      • 1970-01-01
      • 1970-01-01
      • 2013-03-13
      相关资源
      最近更新 更多