操作系统:Manjaro
终端:zsh
➜ ~ curl www.google.com
curl: (7) Failed to connect to www.google.com port 80: 连接超时
- 安装
polipo
sudo pacman -Ss polipo # 搜索看看软件库中有没有
sudo pacman -S polipo # 肯定是有的,安装它
- 配置 polipo
sudo vim /etc/polipo/config
- 在它的末尾添加以下命令,或者去掉以下命令前面的注释符号;若此文件不存在,则自己创建
socksParentProxy = "localhost:1080"
socksProxyType = socks5
- 重新启动 polipo 服务
sudo systemctl restart polipo.service
- 查看状态
sudo systemctl status polipo.service
● polipo.service - Polipo Proxy Server
Loaded: loaded (/usr/lib/systemd/system/polipo.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2019-01-24 17:19:55 CST; 2h 27min ago
Main PID: 2046 (polipo)
Tasks: 1 (limit: 4915)
Memory: 504.0K
CGroup: /system.slice/polipo.service
└─2046 /usr/bin/polipo
1月 24 17:19:55 TpPc systemd[1]: Started Polipo Proxy Server.
1月 24 17:19:55 TpPc polipo[2046]: DNS: couldn't parse line in /etc/resolv.conf -- skipping.
1月 24 17:19:55 TpPc polipo[2046]: Established listening socket on port 8123.
- 终端设置代理环境
export http_proxy=http://localhost:8123
export https_proxy=http://localhost:8123
- 重启终端后代理环境失效,需要再次设置上面的两条命令
- 如果想长期生效的那么在
.zshrc
或者.bashrc
下增加
export https_proxy=http://localhost:8123
export http_proxy=http://localhost:8123
polipo 的默认端口时 8123
➜ ~ curl www.google.com
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en-SG"><head>
....
</html>%