标签:
# Ubuntu/debian sudo apt-get install privoxy # Centos sudo yum install privoxy # Mac osx sudo port install privoxy
vi /etc/privoxy/config
# HTTP parent looks like this:
#
forward-socks4 / 127.0.0.1:1080 .
#
# To chain Privoxy and Tor, both running on the same system, you
# would use something like:
#
forward-socks5 / 127.0.0.1:1080
主要是forward-socks 这两行,1080是socks代理开启的端口,根据自己实际情况修改
配置完成后,重启privoxy,sudo service privoxy restart
vi ~/.bashrc,添加如下代码:
function proxy_off(){
unset http_proxy
unset https_proxy
unset ftp_proxy
unset rsync_proxy
echo -e "已关闭代理"
}
function proxy_on() {
export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
export http_proxy="http://127.0.0.1:8118"
export https_proxy=$http_proxy
export ftp_proxy=$http_proxy
export rsync_proxy=$http_proxy
export HTTP_PROXY=$http_proxy
export HTTPS_PROXY=$http_proxy
export FTP_PROXY=$http_proxy
export RSYNC_PROXY=$http_proxy
echo -e "已开启代理"
}
使用的时候,需要开启http代理时,就在命令行输入:proxy_on
此种情况多数用于命令行需要链接的服务器,被墙需要扶梯子时,比如下载android源码,chromium源码 …
推荐一个扶梯子的站点:http://t.cn/RtKobrk
Bash终端命令行,使用privoxy将socks代理转成http代理
标签:
原文地址:http://www.cnblogs.com/wangyk517/p/5746879.html