〖Linux〗Ubuntu設定Proxy及忽略Proxy

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   for   div   linux   

1. 設定代理:. ~/.proxyenv

 1 #!/bin/sh 2  3 # for terminal 4 export proxyserveraddr=123.123.123.123 5 export proxyserverport=8087 6 export HTTP_PROXY="http://$proxyserveraddr:$proxyserverport/" 7 export HTTPS_PROXY="https://$proxyserveraddr:$proxyserverport/" 8 export FTP_PROXY="ftp://$proxyserveraddr:$proxyserverport/" 9 export SOCKS_PROXY="socks://$proxyserveraddr:$proxyserverport/"10 export NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com,200.200..;11.11.0.0;"11 export http_proxy="http://$proxyserveraddr:$proxyserverport/"12 export https_proxy="https://$proxyserveraddr:$proxyserverport/"13 export ftp_proxy="ftp://$proxyserveraddr:$proxyserverport/"14 export socks_proxy="socks://$proxyserveraddr:$proxyserverport/"15 export no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com,200.200..;11.11.0.0;"16 17 # for chrome,firefox18 gsettings set org.gnome.system.proxy ignore-hosts "[‘localhost‘, ‘11.11.0.0/16‘, ‘200.200.0.0/16‘, ‘*.localdomain.com‘ ]"19 20 # for apt-get21 cat <<-EOF| sudo tee /etc/apt/apt.conf22 Acquire::http::proxy "http://$proxyserveraddr:$proxyserverport/";23 Acquire::https::proxy "https://$proxyserveraddr:$proxyserverport/";24 Acquire::ftp::proxy "ftp://$proxyserveraddr:$proxyserverport/";25 Acquire::socks::proxy "socks://$proxyserveraddr:$proxyserverport/";26 EOF

2. 取消代理:. ~/.unproxyenv

 1 #!/bin/sh 2 unset proxyserveraddr 3 unset proxyserverport 4 unset HTTP_PROXY 5 unset HTTPS_PROXY 6 unset FTP_PROXY 7 unset SOCKS_PROXY 8 unset NO_PROXY 9 unset http_proxy10 unset https_proxy11 unset ftp_proxy12 unset socks_proxy13 unset no_proxy14 gsettings reset org.gnome.system.proxy ignore-hosts15 echo -n ""|sudo tee /etc/apt/apt.conf

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.