Skip to content

使用privoxy和shadowsocks搭建局域网http代理

LinHui Lou edited this page Mar 17, 2017 · 2 revisions

需求

开发环境迁移到局域网,由于github被墙,无法自动安装legolas-vim。

步骤

  1. 安装shadowsocks并配置(~/.ShadowsocksX/gfwlist.js)

     // var proxy = "SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT;";
     var proxy = "PROXY 0.0.0.0:1080; SOCKS 0.0.0.0:1080; DIRECT;";
    
  2. 安装privoxy并配置(/usr/local/etc/privoxy/config):

     listen-address  0.0.0.0:8118
     forward-socks5 / localhost:1080 .
    
  3. 启动privoxy:

     /usr/local/Cellar/privoxy/3.0.26/sbin/privoxy /usr/local/etc/privoxy/config
     // 确认是否成功启动
     lsof -i:8118
     COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
     privoxy 91575 xxxxxxx    4u  IPv4 0x909f5e901e5c5fff      0t0  TCP *:privoxy (LISTEN)
    
  4. 设置github全局代理

     git config --global https.proxy https://xxx.xxx.xxx.xxx:8118
     git config --global http.proxy http://xxx.xxx.xxx.xxx:8118 
     git config --global core.gitProxy socks5://localhost:1080
    
  5. 取消github代理设置

     git config --global --unset http.proxy
     git config --global --unset https.proxy
    
Clone this wiki locally