Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

终端代理科学上网 #64

Open
iliuyt opened this issue Jun 24, 2020 · 0 comments
Open

终端代理科学上网 #64

iliuyt opened this issue Jun 24, 2020 · 0 comments

Comments

@iliuyt
Copy link
Owner

iliuyt commented Jun 24, 2020

设置好科学上网后,发现浏览器可以正常访问,但中国终端执行命令时各种无法访问,查资料后发现,原来需要设置终端代理才可以正常访问。

那么首先我们需要对科学上网工具打开http代理功能,有些工具是默认打开的,找到http代理端口,然后在终端.bash_profile中添加一下命令

function unproxy(){
    unset http_proxy
    unset https_proxy
    echo -e "已关闭代理"
}

function proxy() {
    export no_proxy="localhost,127.0.0.1"
    export http_proxy="http://127.0.0.1:1081"
    export https_proxy=$http_proxy
    echo -e "已开启代理"
}

然后执行source ~/.bash_profile
在我们需要代理时,在终端执行proxy命令即可,关闭时执行unproxy命令(前提是科学上网工具已打开)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant