目前只测试了Mac和Ubuntu
1.安装 privoxy
Mac
brew install privoxy
ubuntu
sudo apt-get install privoxy
2.配置 privoxy
Mac
vi /usr/local/etc/privoxy/config
Ubuntu
sudo vi /etc/privoxy/config
注释掉
listen-address localhost:8118
在最后一行添加
forward-socks5t / 127.0.0.1:1080 .
listen-address 127.0.0.1:8118
127.0.0.1:1080
为 socks5代理地址及端口
127.0.0.1:8118
为转换为http 代理后的地址及端口,8118
如果被占用,可以修改,比如我使用的是10800
, 方便记忆
3.启动 privoxy
Mac
/usr/local/sbin/privoxy /usr/local/etc/privoxy/config
Ubuntu
sudo service privoxy restart
4.使用http代理
# http://127.0.0.1:8118 为第2部具体配置的listen-address
export http_proxy='http://127.0.0.1:8118'
export https_proxy=$http_proxy
5.配置自定义快捷命令
Mac
vi ~/.bash_profile
Ubuntu
vi ~/.bashrc
如果使用的是zsh 修改
vi ~/.zshrc
添加
alias proxyon="export http_proxy='http://127.0.0.1:8118'; export https_proxy=$http_proxy"
alias proxyoff="unset http_proxy; unset https_proxy"
使配置生效
Mac
source ~/.bash_profile
Ubuntu
source ~/.bashrc
如果使用的zsh
source ~/.zshrc
后续开启代理使用proxyon
命令即可,关闭代理使用proxyoff