目前只测试了Mac和Ubuntu
1.安装 privoxy
Mac
brew install privoxyubuntu
sudo apt-get install privoxy2.配置 privoxy
Mac
vi /usr/local/etc/privoxy/configUbuntu
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/configUbuntu
sudo service privoxy restart4.使用http代理
# http://127.0.0.1:8118 为第2部具体配置的listen-address
export http_proxy='http://127.0.0.1:8118'
export https_proxy=$http_proxy5.配置自定义快捷命令
Mac
vi ~/.bash_profileUbuntu
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_profileUbuntu
source ~/.bashrc如果使用的zsh
source ~/.zshrc后续开启代理使用proxyon命令即可,关闭代理使用proxyoff