apache - 80端口在服务器上打开但无法连接到它

标签 apache http tcp ssh port

我有一个问题,我一直在努力解决,但无法弄清楚发生了什么。我有各种网络服务器,它们都安装了 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

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

最佳答案

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

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

关于apache - 80端口在服务器上打开但无法连接到它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23940674/

相关文章:

windows - 如何修复 "The _imaging C module is not installed"Django/WSGI/Apache

apache - 在同一个 Apache 中将 https 重定向到 https

php - Beanstalk 获取套接字错误 110 : Connection timed out

php - 为什么不在这里使用 POST 方法?

http - Put 与 Post - REST

delphi - Indy TCPServer 在客户端连接时出现 `Connection reset by peer` 错误

sockets - JPOS QMUX的配置

php - Laravel5 仅在 linux 中显示默认页面...在 windows 中同样有效

php - 在 Linux 上使用 mod_xsendfile 使用 PHP 下载大文件

json - 从有 Angular 的 ui-modal 发出发布请求