IT开发人员常用的代理设置

NPM 配置
使用这些命令:

npm config set proxy http://username:password@host:port
npm config set https-proxy http://username:password@host:port
或者编辑用户目录下的 ~/.npmrc file:

proxy=http://username:password@host:port
https-proxy=http://username:password@host:port
https_proxy=http://username:password@host:port

Yarn 配置
使用这些命令:

yarn config set proxy http://username:password@host:port
yarn config set https-proxy http://username:password@host:port

Git 配置
使用这些命令:

git config --global http.proxy http://username:password@host:port
git config --global https.proxy http://username:password@host:port
或者编辑用户目录下的~/.gitconfig file:

[http]
proxy = http://username:password@host:port
[https]
proxy = http://username:password@host:port

Maven 配置
编辑文件 ~/.m2/settings.xml file

id true http

host
port
local.net|some.host.com

Maven Wrapper
在项目文件夹中创建一个新文件.mvn / jvm.config并相应地设置属性:

-Dhttp.proxyHost=host
-Dhttp.proxyPort=port
-Dhttps.proxyHost=host
-Dhttps.proxyPort=port
-Dhttp.proxyUser=username
-Dhttp.proxyPassword=password

Gradle配置
如果要通过代理下载包装器,请在gradle.properties文件和gradle / wrapper / gradle-wrapper.properties文件中添加以下内容

如果要全局设置这些属性,请将其添加到USER_HOME / .gradle / gradle.properties文件中

Proxy setup

systemProp.proxySet=“true”
systemProp.http.keepAlive=“true”
systemProp.http.proxyHost=host
systemProp.http.proxyPort=port
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=local.net|some.host.com

systemProp.https.keepAlive=“true”
systemProp.https.proxyHost=host
systemProp.https.proxyPort=port
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=local.net|some.host.com

end of proxy setup

Docker
原生Docker
根据您的操作系统,您必须编辑特定文件(/ etc / sysconfig / docker或/ etc / default / docker)。

然后,您必须使用以下命令重新启动docker服务:sudo service docker restart。

它不适用于systemd。 从docker中查看此页面以配置代理。

Docker与docker-machine
您可以使用以下命令创建docker-machine:

docker-machine create -d virtualbox
–engine-env HTTP_PROXY=http://username:password@host:port
–engine-env HTTPS_PROXY=http://username:password@host:port
default
或者编辑文件 ~/.docker/machine/machines/default/config.json.

Python pip 代理设置

sudo pip --proxy=http://username:[email protected]:8118 install 组件名称

Scala SBT 代理设置

export SBT_HOME=/usr/share/sbt-launcher-packaging
SBT_OPTS="-Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
#export SBT_OPTS=“ S B T O P T S D h t t p s . p r o x y H o s t = 123.124.125.126 D h t t p s . p r o x y P o r t = 8080 " e x p o r t S B T O P T S = " SBT_OPTS -Dhttps.proxyHost=123.124.125.126 -Dhttps.proxyPort=8080" export SBT_OPTS=" SBT_OPTS -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=7070”
export PATH= P A T H : PATH: SBT_HOME/bin

source ~/.bashrc or ~/.zshrc

如果无效
直接在sbt 后面跟上参数
-DsocksProxyHost=代理服务器IP -DsocksProxyPort=代理服务器端口

sbt project -DsocksProxyHost=10.20.1.1 -DsocksProxyPort=8118

Go语言代理设置

set http_proxy=http://10.20.1.1:8118
set https_proxy=https://10.20.1.1:8118
linux/mac 平台

export http_proxy=http://10.20.1.1:8118
export https_proxy=https://10.20.1.1:8118

Shell Wget 代理设置

linux/mac 平台

export http_proxy=http://10.20.1.1:8118
export https_proxy=https://10.20.1.1:8118
wget http://aiezu.com/test.php

Shell Curl 代理设置

export http_proxy=http://10.20.1.1:8118
export https_proxy=https://10.20.1.1:8118
curl -I 目标网址

curl -v -I 目标网址

Yum 代理设置
在/etc/yum.conf后面添加以下内容:

  1. 如果代理不需要用户名密码认证:
    proxy=http://代理服务器IP地址:端口号
  2. 如果需要认证
    proxy=http://代理服务器IP地址:端口号
    proxy_username=代理服务器用户名

猜你喜欢

转载自blog.csdn.net/happyfreeangel/article/details/84998968