1. 程式人生 > >Polipo全域性代理設定方法

Polipo全域性代理設定方法

https://www.aliyun.com/jiaocheng/118908.html

  • 摘要:Shadowsocks是我們常用的代理工具,它使用socks5協議,而終端很多工具目前只支援http和https等協議,對socks5協議支援不夠好,所以我們為終端設定shadowsocks的思路就是將socks協議轉換成http協議,然後為終端設定即可。通過polipo進行二次轉發(shadowsocks使用socks5協議通訊,需搭配瀏覽器外掛使用,若想要在系統全域性使用,可使用polipo進行二次轉發)1安裝poliposudoapt-getinstallpolipo2編
  •  

    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全域性代理設定方法
     

    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配置