mac 开启终端代理

mac打开终端代理

1 打开终端代理 vim ~/.zshrc(如果没后.zshrc文件就自己新建一个)
2 然后按 i 编辑一下命令

# -------------------------------
# polipo proxy on/off
# ------------------------------
function proxy_on() {
    # 配置http访问的
    export http_proxy=http://127.0.0.1:1087
    # 配置https访问的
    export https_proxy=$http_proxy
    # 配置http和https访问
    export all_proxy=$http_proxy
    # export PATH="/usr/local/opt/openssl/bin:$PATH"
    export ftp_proxy=$http_proxy
    export rsync_proxy=$http_proxy
    export HTTP_PROXY=$http_proxy
    export HTTPS_PROXY=$http_proxy
    export FTP_PROXY=$http_proxy
    export RSYNC_PROXY=$http_proxy
    echo  '********   开启当前终端代理gutu   ********'
}
function proxy_off() {
    # 移除代理
    unset http_proxy
    unset https_proxy
    unset all_proxy
    unset ftp_proxy
    unset rsync_proxy
    unset HTTP_PROXY
    unset HTTPS_PROXY
    unset FTP_PROXY
    unset RSYNC_PROXY
    echo  '********   关闭当前终端代理gutu   ********'
}

注意:export http_proxy=‘这里的地址请查看自己的纸飞机的地址,点击纸飞机然后进入Http代理设置把HTTP代理监听地址和端口换上去

3 按EST退出编辑,然后 :wq退出

4 通过命令 source ~/.zshrc 保存 刷新文件

5 curl cip.cc // 查看当前的ip

6 curl http://www.gooogle.com //向url发送请求,查看时候链接代理成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值