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

http proxy #314

Open
uniquejava opened this issue May 17, 2020 · 0 comments
Open

http proxy #314

uniquejava opened this issue May 17, 2020 · 0 comments

Comments

@uniquejava
Copy link
Owner

uniquejava commented May 17, 2020

作为一个国产程序员 写点代码真心累, 每天或多或少都要面对proxy的问题。

此处记录我用到的所有软件设置proxy的方法。

VM options (Eclipse or IDEA)

-Dhttp.proxyHost=proxy.xyz.com
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=proxy.xyz.com
-Dhttps.proxyPort=8080
-Dhttp.nonProxyHosts=*.xyz.com
-Dhttps.nonProxyHosts=*.xyz.com

Brew

先执行set_http_proxy 然后正常使用brew命令

 set_http_proxy() {
   if [ -e $HOME/.proxyrc ]; then
     . $HOME/.proxyrc
   fi

   if [ -z $http_proxy ]; then
     echo "No proxy config, environment found, connection attempt failed."
     echo "Let's setup a config or update your password."
     #read 'eid?eID: '
     #read -s 'password?Password: '
     #http_proxy="http://${eid}:${password}@<your.proxy.net:port>/"
     #https_proxy="http://${eid}:${password}@<your.proxy.net:port>/"
     http_proxy="http://proxy.xxxx.xyz.com:8080"
     https_proxy="http://proxy.xxxx.xyz.com:8080"
     no_proxy="localhost,127.0.0.1"
     echo "export http_proxy=$http_proxy" > $HOME/.proxyrc
     echo "export HTTP_PROXY=$http_proxy" >> $HOME/.proxyrc
     echo "export https_proxy=$https_proxy" >> $HOME/.proxyrc
     echo "export HTTPS_PROXY=$https_proxy" >> $HOME/.proxyrc
     echo "export NO_PROXY=$no_proxy" >> $HOME/.proxyrc
     echo "export no_proxy=$no_proxy" >> $HOME/.proxyrc
     . $HOME/.proxyrc
   fi
 }

 kill_http_proxy() {
   rm $HOME/.proxyrc
   unset_http_proxy
 }

 unset_http_proxy() {
   unset http_proxy
   unset HTTP_PROXY
   unset https_proxy
   unset HTTPS_PROXY
 }

或者: https://www.jianshu.com/p/005963a4d843 (没试)

Android Studio

启动时报Gradle read timed out error on flutter_embedding_debug jar
Preferences > Http Proxy (还可能需要检查一下~/.gradle/*.properties)

Android Emulator

Settings > Proxy

Docker设置aliyun镜像

在~/.docker/daemon.json或/etc/docker/daemon.json 文件并添加上 registry-mirrors 键值然后重启。

 {
   "experimental" : false,
   "debug" : true,
   "registry-mirrors": [
-      "https://registry.docker-cn.com",
+      "https://8nzelxxxx.mirror.aliyuncs.com"
    ]
 }

pip3设置aliyun镜像

建一个~/.pip/pip.conf文件,加入如下设置

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

搞定.

Maven设置aliyun镜像

vi ~/.m2/settings.xml

<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>        
</mirror>
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