Page

【linux】由于变量没有回收导致的curl:(7) couldn't connect to host

589Anson19-09-28


之前在centos上安装了privoxy以及shadowsocks client来实现科学上网,但由于最近七十周年庆导致被和谐了,所以要把privoxy停掉,然后导致curl:(7) couldn't connect to host

一、前言

    之前在centos上安装了privoxy以及shadowsocks client来实现科学上网,但由于最近七十周年庆导致被和谐了,所以要把privoxy停掉,然后导致curl:(7) couldn't connect to host。接下来分析一下整个过程


二、关闭privoxy服务

service privoxy stop
chkconfig privoxy off

vi /etc/profile # 注释掉对应的变量
# privoxy 环境变量
#export http_proxy=http://127.0.0.1:8118
#export https_proxy=

source /etc/profile  # 让配置生效


三、curl 无法使用

关闭privoxy服务以及删除变量之后curl无法使用,那说明至少有其中之一的操作没有成功,然后我使用service privoxy status查看了privoxy的状态,是关闭的。然后检查了一下/etc/profile文件是否注释了相关变量,也没问题。但是使用命令行模式echo $http_proxy居然是有值的,二话不说先unset http_proxy, unset http_proxys,然后curl就恢复正常了。





来自anson博客 

http://www.tp0.top

2019-10-20 17:51:14