編輯 ~/.bash_profile
文件政模,沒有則創(chuàng)建一個(gè)
如果終端是 zsh岗宣,那么編輯
~/.zshrc
設(shè)置 http 和 https 代理
function proxy_on() {
export http_proxy=socks5://127.0.0.1:7890;
export https_proxy=socks5://127.0.0.1:7890;
export no_proxy=localhost,127.0.0.1,localaddress,.localdomain.com;
}
function proxy_off() {
unset http_proxy;
unset https_proxy;
unset no_proxy;
}
其他代理設(shè)置
# ftp代理
export ftp_proxy=socks5://127.0.0.1:7890;
# rsync代理
export rsync_proxy=socks5://127.0.0.1:7890;
# 設(shè)置所有代理
export all_proxy=socks5://127.0.0.1:7890;
啟動(dòng)代理
proxy_on
關(guān)閉代理
proxy_off
測(cè)試代理是否生效
curl ip.sb