This post is created 2 years ago, the content may be outdated.
在某些特殊网络环境下用代理访问互联网是很麻烦的,即使在本地开启了代理端口,要让所有的软件都使用代理方法也各不相同。
如果有桌面环境,可以在网络连接设置里添加代理,但至于作用范围有多广就不得而知了。
下面里出一些常用软件的代理设置,以供参考。将不断更新添加。
System Environment Variable
1 2 3 4 5 6 7 8
| sudo vi /etc/environment
http_proxy="http://127.0.0.1:8080" HTTP_PROXY="http://127.0.0.1:8080" https_proxy="https://127.0.0.1:1081" HTTPS_PROXY="https://127.0.0.1:1081" no_proxy="127.0.0.1,localhost,localaddress" NO_PROXY="127.0.0.1,localhost,localaddress"
|
Apt
1 2 3
| sudo vi /etc/apt/apt.conf.d/90proxy
Acquire::http { Proxy "http://127.0.0.1:8080"; };
|
Git
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| git config --global http.proxy http://user:[email protected]:8080
git config --global http.https://domain.com.proxy http://user:[email protected]:8080
vi ~/.gitconfig [http] [http "https://domain.com"] proxy = http://user:[email protected]:8080
git config --global --unset http.proxy git config --global --unset http.https://domain.com.proxy
|
Wget
1 2 3 4 5 6 7 8 9 10 11
| sudo vi /etc/wgetrc
vi ~/.wgetrc
use_proxy=yes http_proxy=127.0.0.1:8080 https_proxy=127.0.0.1:8080
wget $URL -e use_proxy=yes -e http_proxy=127.0.0.1:8080
|
curl
与$HTTP_PROXY
一致