curl: (7) Failed connect to IP:port; No route to host解决方案
程序员文章站
2022-03-06 08:15:56
1 场景#打包宝塔成docker镜像的时候,遇到的一个问题,如下:[root@demo110 dockerbt]# netstat -lantp |grep 8tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4797/nginx: mastertcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN...
1 场景
#打包宝塔成docker镜像重启后,宝塔web访问不了,并做了如下的测试都不通,如下:
[root@demo110 dockerbt]# netstat -lantp |grep 8
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 4797/nginx: master
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 5768/python
[root@prometheus113 ~]# ping 172.16.1.138
PING 172.16.1.138 (172.16.1.138) 56(84) bytes of data.
64 bytes from 172.16.1.138: icmp_seq=1 ttl=64 time=0.853 ms
^C
--- 172.16.1.138 ping statistics ---
[root@prometheus113 ~]# telnet 172.16.1.138 80
Trying 172.16.1.138...
telnet: connect to address 172.16.1.138: No route to host
[root@prometheus113 ~]# telnet 172.16.1.138 8888
Trying 172.16.1.138...
telnet: connect to address 172.16.1.138: No route to host
[root@prometheus113 ~]# curl 172.16.1.138:8888/login
curl: (7) Failed connect to 172.16.1.138:8888; No route to host
2 原因
1 可能是因为写了访问控制规则
2 可能是安装或启用了防火墙
3 nginx配置了安全访问
3 解决方案
#通过命令查看防火墙策略
sudo iptables -L | more
#如果输出内容为Chain INPUT (policy DROP),再执行修改策略
sudo iptables -P INPUT ACCEPT
#直到确认输出为Chain INPUT (policy ACCEPT),才可清除所有规则停止防火墙
sudo iptables -F
#关闭防火墙
systemctl stop firewalld.service
本文地址:https://blog.****.net/caiyqn/article/details/107317796
推荐阅读
-
ssh: connect to host 192.168.1.20 port 22: No route to host解决方案
-
curl: (7) Failed to connect to ** port 80: No route to host
-
mac安装homebrew,报错curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refuse
-
curl: (7) Failed connect to IP:port; No route to host解决方案
-
在mac上“curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused”-安装NVM
-
关于Mac下载brew报curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
-
启动hadoop出现ssh: connect to host master port 22: No route to host 问题解决方案
-
解决ssh [email protected]<robot ip>时报错 ssh: connect to host <robot ip> port 22: No route to host
-
curl: (7) Failed connect to IP:port; No route to host解决方案