安装与配置
sudo apt install privoxy
sudo vim /etc/privoxy/config
找到 listen-address 确保有这行代码(默认配置是有的)
listen-address 127.0.0.1:8118
找到 forward-socks5 确保有这行代码(没有自己加,注意最后有个点)
forward-socks5 / 127.0.0.1:1080 .
测试与使用
export http_proxy="http://127.0.0.1:8118"
export https_proxy="http://127.0.0.1:8118"
curl https://ipinfo.io
在 git 中使用
#只对github.com, 只对 https 方式生效, 对 git 协议还没研究明白
git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
#取消
git config --global --unset http.https://github.com.proxy
管理
sudo service privoxy start
sudo service privoxy stop
sudo service privoxy restart
sudo service privoxy status
验证
curl https://ip.cn # curl调用不行, 但能用浏览器访问
curl https://api.ip.sb/geoip # https://ip.sb 能用浏览器访问
curl https://ipinfo.io
其他方案
- proxychains
- tsocks
- polipo
网友评论