Shadowsocks是我們常用的代理工具,它使用socks5協議,而終端很多工具目前只支持http和https等協議,對socks5協議支持不夠好,所以我們爲終端設置shadowsocks的思路就是將socks協議轉換成http協議,然後爲終端設置即可。通過polipo進行二次轉發(shadowsocks使用socks5協議通信,需搭配瀏覽器插件使用,若想要在系統全局使用,可使用polipo進行二次轉發)
1 安裝polipo
sudo apt-get install polipo
2 編輯配置文件
配置文件位置 /etc/polipo/config
# This file only needs to list configuration variables that deviate
# from the default values. See /usr/share/doc/polipo/examples/config.sample
# and "polipo -v" for variables you can tweak and further information.
logSyslog = true
logFile = /var/log/polipo/polipo.log
proxyAddress = "0.0.0.0"
socksParentProxy = "127.0.0.1:1080"
socksProxyType = socks5
proxyPort = 8123
chunkHighMark = 50331648
objectHighMark = 16384
serverMaxSlots = 64
serverSlots = 16
serverSlots1 = 32
3 重啓polipo服務
/etc/init.d/polipo restart
4 通過curl驗證代理http是否成功
#不使用代理
curl ip.sb
#使用代理
http_proxy=http://127.0.0.1:8123
curl ip.sb
如果此處不成功,打開系統控制面板
System settings -> Network -> Network proxy
設置如圖所示
polipo的默認端口號是 8123
每次使用代理前 export http_proxy=http://127.0.0.1:8123
取消代理 unset http_proxy
如果想要更長久的設置代理,可以將 export http_proxy=http://127.0.0.1:8123
加入 .bashrc
文件,然後Linux用戶 執行 source ~/.bashrc
更新當前bash配置
作者:超能_
鏈接:https://www.jianshu.com/p/c2f91d95434d
來源:簡書
簡書著作權歸作者所有,任何形式的轉載都請聯繫作者獲得授權並註明出處。