各种应用使用代理的方法
每次使用一个应用,就学习一种代理配置方法,慢慢的埋了不少的坑,更换代理又各种重新搜索,重新学习,这下搞个汇总:
- tomcat:bin/catalina.sh
JAVA_OPTS="$JAVA_OPTS -Dhttp.proxyHost=ip -Dhttp.proxyPort=port -Dhttp.nonProxyHosts='localhost|appserver1|127.*|10.*|100.*'"
- maven:settings.xml
<settings> <proxies> <proxy> <id>optional</id> <host>ip</host> <port>port</port> <nonProxyHosts>192.*.*.*</nonProxyHosts> <protocol>http</protocol> <active>true</active> </proxy> </proxies> </settings>
- jenkins:插件管理-高级-代理设置
- linux全局配置:/etc/profile、单个用户配置:
~/.bashrc
export http_proxy="http://user:pwd@proxyip:3128" export https_proxy="http://user:pwd@proxyip:3128"
- yum
配置方式:/etc/yum.conf proxy=http://proxyip:3128
proxy_username=username
proxy_password=password - rpm
配置方式:~/.bash_profile export http_proxy=http://proxyip:3128/ export ftp_proxy=http://proxyip:3128/
- wget
配置方式: /etc/wgetrc http_proxy = http://proxyip:3128/ ftp_proxy = http://proxyip:3128/ 命令方式:
- curl
配置方式:~/.curlrc export http_proxy="http://user:pwd@proxyip:3128" export https_proxy="http://user:pwd@proxyip:3128" 命令方式: curl -x "http://user:pwd@proxyip:3128" "http://destination"
- npm:~/.npmrc
proxy=http://ip:3128/ https-proxy=http://ip:3128/
命令行:
npm --proxy http://username:password@cacheaddress.com.br:80 install packagename