我在wget的时候遇到下面的问题,
hz@Asia:~/tmp$ wget https://qq.com
--2017-11-16 15:18:57-- https://qq.com/
正在连接 127.0.0.1:36627... 失败:拒绝连接。
定位问题步骤如下:
- 查看本地端口的使用情况
hz@Asia:~/tmp$ sudo netstat -ntpl
激活Internet连接 (仅服务器)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1061/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2696/cupsd
tcp6 0 0 :::22 :::* LISTEN 1061/sshd
tcp6 0 0 ::1:631 :::* LISTEN 2696/cupsd
发现并没有服务在占用端口36627
2. 查看本地网络是否走了代理服务
hz@Asia:~/tmp$ export | grep -i proxy
declare -x COMPIZ_CONFIG_PROFILE="ubuntu"
declare -x HTTPS_PROXY="http://127.0.0.1:36627/"
declare -x HTTP_PROXY="http://127.0.0.1:36627/"
declare -x NO_PROXY="localhost,127.0.0.0/8,::1"
declare -x http_proxy="http://127.0.0.1:36627/"
declare -x https_proxy="http://127.0.0.1:36627/"
declare -x no_proxy="localhost,127.0.0.0/8,::1"
在找到了被占用的端口的36627, 确实是走了代理,于是问题找到了。
解决方法:
关闭服务
hz@Asia:~/tmp$ unset HTTPS_PROXY
hz@Asia:~/tmp$ unset https_proxy
hz@Asia:~/tmp$ wget https://qq.com
--2017-11-16 15:20:15-- https://qq.com/
正在解析主机 qq.com (qq.com)... 125.39.240.113, 61.135.157.156
正在连接 qq.com (qq.com)|125.39.240.113|:443... 已连接。
邮箱:tanya.h@aliyun.com