Linux/Mac Terminal Proxy Settings, Cancel and Exclude Lists

In an unfriendly network environment, some development resources (dependencies) cannot be downloaded and installed directly. At this time, we need to use a proxy.

If the terminal is used frequently, the content of the terminal about the proxy is essential.

set http proxy

 1 2 3 4 5 
$ export http_proxy=http://server-ip:port/ $ export http_proxy=http://127.0.0.1:3128/ $ export http_proxy=http://proxy-server.mycorp.com:3128/ $ export http_proxy=socks5://PROXYHOST:PROXYPORT 

set https proxy

 1 2 3 4 
$ export https_proxy=https://server-ip:port/ $ export https_proxy=https://127.0.0.1:3128/ $ export https_proxy=https://proxy-server.mycorp.com:3128/ $ export https_proxy=socks5://PROXYHOST:PROXYPORT

unset proxy

 1 2 3 
unset http_proxy unset https_proxy

Set proxy exclusion list

Sometimes, we need to open the proxy, but some domain names do not go through the proxy, such as

  • Internal network, using a proxy will give an error
  • Domestic network, it will slow down after using a proxy
 1 2 
 export NO_PROXY=droidyue.com,127.0.0.1

The above setting proxy, setting proxy exclusion list, can also be placed in .bashrc or .zshrc for automatic persistence processing.

droidyue_gzh_green_png.png

This article is reprinted from https://droidyue.com/blog/2022/08/09/proxy-setting-in-terminal/
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment