试验

  • 文档在 ubuntu 已经试验有效, 其他系统有待尝试

    Linux 系统变量方式设置全局代理

  • 某些程序不识别大写的变量,所以大小写都设置上

  • 同时设置 socket5 和 http/https 可以利于代理服务的流量分流
    1. export IP_PROXY="192.168.1.2"
    2. export ALL_PROXY="socks5://$IP_PROXY:7890"
    3. export all_proxy=$ALL_PROXY
    4. export HTTP_PROXY="http://$IP_PROXY:7890"
    5. export http_proxy=$HTTP_PROXY
    6. export HTTPS_PROXY=$HTTP_PROXY
    7. export https_proxy=$HTTP_PROXY

    Linux 下常用软件设置代理

    Git 设置代理

    1. git config --global http.proxy "socks5://0.0.0.0:1080"
    2. git config --global https.proxy "socks5://0.0.0.0:1080"

    NPM 设置代理

    1. npm config set proxy "http://0.0.0.0:1090"
    2. npm config set https-proxy "http://0.0.0.0:1090"

    YARN 设置代理

    1. yarn config set proxy "http://0.0.0.0:1090"
    2. yarn config set https-proxy "http://0.0.0e.0:1090"