CentOS 7 wget 正在连接 127.0.0.1:8118... 失败:拒绝连接。

正在使用wget下载包的时候,出现了拒绝连接的错误

[root@CentOS7 local]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
--2020-04-11 23:46:24--  http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
正在连接 127.0.0.1:8118... 失败:拒绝连接。

查找问题的方法如下:

  1. 查看本地端口是否被占用
[root@CentOS7 local]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1151/cupsd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1480/master         
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      1612/dnsmasq        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1150/sshd           
tcp6       0      0 ::1:631                 :::*                    LISTEN      1151/cupsd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      1480/master         
tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
tcp6       0      0 :::22                   :::*                    LISTEN      1150/sshd           

  • 本地端口8118并没有被占用
  1. 查看本地网络代理
[root@CentOS7 local]# export | grep -i proxy
declare -x ftp_proxy="http://127.0.0.1:8118"
declare -x http_proxy="http://127.0.0.1:8118"
declare -x https_proxy="http://127.0.0.1:8118"

  • 网络http确实有代理,几乎可以断定是这个代理引发的错误。

解决办法:

  • 尝试关闭代理,然后重新使用wget下载
[root@CentOS7 local]# unset http_proxy 
[root@CentOS7 local]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
--2020-04-11 23:48:38--  http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz
正在解析主机 jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)... 150.65.7.130, 2001:df0:2ed:feed::feed
正在连接 jaist.dl.sourceforge.net (jaist.dl.sourceforge.net)|150.65.7.130|:80... 已连接。

wget连接成功!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值