33
38

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

プロキシメモ帳

Last updated at Posted at 2014-08-22

プロキシの環境で各開発ソフトウェアのプロキシ設定のメモ帳です。

npm プロキシ

npm config set proxy http://username:password@hostname:port

cygwin/shell プロキシ

Git プロキシ

git config -l
git config --global http.proxy http://user:pass@hostname:port

gradle プロキシ

vi ~/.gradle/gradle.properties

systemProp.http.proxyHost=host
systemProp.http.proxyPort=port
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost|local.net|some.host.com

bower プロキシ

~/.bowerrcファイルに以下の様に設定する

{
  "proxy" : "http://proxy.example.co.jp:8080",
  "https-proxy" : "http://proxy.example.co.jp:8080"
}

java shell プロキシ

-Dhttp.proxyPort=port
-Dhttp.proxyHost=hostname
-Dhttp.proxyUser=user
-Dhttp.proxyPassword=pass
-Dhttp.nonProxyHosts=localhost|127.0.0.1
-Dhttps.proxyPort=port
-Dhttps.proxyHost=hostname
-Dhttps.proxyUser=user
-Dhttps.proxyPassword=pass
-Dhttps.nonProxyHosts=localhost|127.0.0.1

java code プロキシ

System.setProperty("http.proxyPort", port);
System.setProperty("http.proxyHost", "hostname");
//System.setProperty("http.proxyUser", "username"); // Not work! Use bellow
//System.setProperty("http.proxyPassword", "password"); // Not work! Use bellow
System.setProperty("http.nonProxyHosts", "localhost|127.0.0.1");

// ●From java 1.5, use this way to set proxy user authentication:
final String authUser = "username";
final String authPassword = "password";
java.net.Authenticator.setDefault(
	new Authenticator() {
		public PasswordAuthentication getPasswordAuthentication() {
			return new PasswordAuthentication(
				authUser, authPassword.toCharArray());
		}
	}
);

SVN プロキシ

On Linux or Unix it is located in the directory "~/.subversion".
On Windows it is in "%APPDATA%\Subversion".

注意:必ず[global]の節で修正:

[global]
http-proxy-exceptions = localhost, 
http-proxy-hostname=xxxx
http-proxy-port=xx
http-proxy-username=xxx
http-proxy-password=xxx
http-timeout = 60
http-auth-types = basic;digest;negotiate
neon-debug-mask = 130

pip プロキシ

pip install package_name --proxy=http://user:pwd@hostname:port

Maven プロキシ

conf/settings.xmlの約100行目の<proxy>節のコメントアウトを外す:

    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxy.host.net</host>
      <port>80</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>

activator(Play Framework/Scala) プロキシ

vi ~/.activator/activatorconfig.txt

Windowsの場合:
mkdir %USERPROFILE%\.activator
nodepad %USERPROFILE%\.activator\activatorconfig.txt

# This are the proxy settings we use for activator
-Dhttp.proxyHost=PUT YOUR PROXY HOST HERE
-Dhttp.proxyPort=PUT YOUR PROXY PORT HERE
-Dhttp.proxyUser=PUT YOUR PROXY USER HERE
-Dhttp.proxyPassword=PUT YOUR PROXY PASSWORD HERE

# Here we configure the hosts which should not go through the proxy.  You should include your private network, if applicable.
-Dhttp.nonProxyHosts="localhost|127.0.0.1"

cURL プロキシ

curl -U username:password -x hostname:port -L https://www.google.com

または、

vi ~/.curlrc
proxy-user = "username:password"
proxy = "http://hostname:port"

Wget プロキシ

vi ~/.wgetrc
http_proxy=http://hostname:port
proxy_user=${user}
proxy_password=${pass}

yum プロキシ

sudo vi /etc/yum.conf
proxy=http://hostname:port
proxy_username=${user}
proxy_password=${pass}

Gem/Bundle プロキシ

gem install パッケージ名 -r -p http://username:password@proxy.hostname:port

または、

vi ~/.gemrc
export  http_proxy = "http://username:password@hostname:port"
export https_proxy = "http://username:password@hostname:port"

Vagrant プロキシ

【Win一時】

set  http_proxy=http://username:password@hostname:port
set https_proxy=http://username:password@hostname:port

【Win永久】

setx  http_proxy http://username:password@hostname:port
setx https_proxy http://username:password@hostname:port

【Linux】

export  http_proxy=http://username:password@hostname:port
export https_proxy=http://username:password@hostname:port
33
38
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
33
38

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?