LoginSignup
64
80

More than 5 years have passed since last update.

Linux,Windowsのプロキシ設定あれこれ

Last updated at Posted at 2015-08-03

気づいたら足していく。

全体設定

LinuxであればHTTP_PROXY環境変数に設定する。不都合なければ.bashrcとかで設定してしまえばあとは楽。Windowsはインターネットオプションで設定する。

$ export HTTP_PROXY=http://proxyserver:8080

Windows Update

Windows Updateに限らず、WinHTTPを利用したHTTP通信が発生する場合にはこれ。

rem IEからプロキシ設定を読み込む
> netsh winhttp import proxy source=ie
rem 手書きで設定する
> netsh winhttp set proxy proxy-server="http://proxyserver:8080" bypass-list="http://example.com;local"

yum

/etc/yum.conf
# Proxy Setting
proxy=http://proxyserver:8080
proxy_username=user
proxy_password=password

apt

RPM

$ rpm -ivh --httpproxy http://proxyserver --httpport 8080 ~~

wget

/etc/wgetrc
# コメントアウトを外して記入
http_proxy = http://proxyserver:8080
https_proxy = http://proxyserver:8080

curl

$HOME/.curlrc
proxy-user = "user:password"
proxy = "http://proxyserver:8080"

もしくは$ curl -U user:password -x http://proxyserver:8080 -L targeturl

Git

HTTP_PROXY環境変数を読むようだが、Git用に設定する場合は以下。

$ git config --global http.proxy http://proxyserver:8080

RubyGems

HTTP_PROXY環境変数を読むが、~/.gemrcで設定もできる。

~/.gemrc
http_proxy: http://proxyserver:8080

gem installするときにオプションで指定することも可能。

$ gem install foo -r -p http://proxyserver:8080

pip

$  pip install foo --proxy=user@proxyserver:port

npm

$ npm config set proxy http://proxyserver:8080
$ npm config set https-proxy https://proxyserver:8080

golang

go getする際。HTTP_PROXYが参照される。

64
80
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
64
80