代理服务器-Privoxy
2013-05-06 14:19:22 阿炯

本站赞助商链接,请多关照。 Privoxy是一款带过滤功能的代理服务器,针对HTTP、HTTPS协议。通过Privoxy的超级过滤功能,用户从而可以保护隐私、对网页内容进行过滤、管理cookies,以及拦阻各种广告等。Privoxy可以用作单机,也可以应用到多用户的网络。
基本上所有网页浏览器均可使用Privoxy。对于没有原生支持SOCKS代理的第三方非浏览器应用程序而言,仍然推荐使用Privoxy。当用户直接使用 SOCKS 代理访问网络时,浏览器会泄漏 DNS 请求,降低匿名性,这时应该使用 Privoxy。而它可以修改HTTP请求头的字段,如Referrer和用户代理(User Agent),从而隐藏用户上一个查看的网页和用户正在使用的浏览器。

Privoxy基于Internet Junkbuster,按照GNU General Public License进行发布。可以在Linux、Windows、Mac OS X、AmigaOS、BeOS,以及各种Unix上运行。

Privoxy is a non-caching web proxy with advanced filtering capabilities for enhancing privacy, modifying web page data and HTTP headers, controlling access, and removing ads and other obnoxious Internet junk. Privoxy has a flexible configuration and can be customized to suit individual needs and tastes. It has application for both stand-alone systems and multi-user networks.

Privoxy is Free Software and licensed under the GNU GPLv2.


基本配置

/etc/privoxy/config 这个主配置文件
先搜索关键字 listen-address 找到 listen-address 127.0.0.1:8118 这一句,保证这一句没有注释,8118就是将来http代理要输入的端口。Privoxy默认只提供给本机使用(即localhost或者127.0.0.1),如果需要将Privoxy提供给网络中的其他计算机使用,需要在其config中添加监听信息。

将socks5转换为 http 代理

然后搜索 forward-socks5t, 将 #forward-socks5t        /    127.0.0.1:1080

此句前面的注释去掉, 意思是转发流量到本地的1080端口, 而1080端口正是另外的代理软件监听的端口。


使用示例

当前shellhttp_proxy环境变量,例如添加到~/.bashrc中后进行测试:
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118

可以给 git 设置 http 或 https 代理,设置方式如下:
git config --global http.proxy http://127.0.0.1:8118
git config --global https.proxy http://127.0.0.1:8118

取消代理配置:
git config --global --unset http.proxy
git config --global --unset https.proxy

和其他 git 的配置一样,不使用命令行而是直接修改相应的 .gitconfig 文件也是可以的。当然如果不想修改 git 配置,而只是想临时使用一下,可以使用 -c 参数:
git -c https.proxy=http://127.0.0.1:8118 clone --depth=1 https://github.com/xxx/xxx


最新版本:3.0


官方主页:http://www.privoxy.org/