プロキシメモ帳

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

npm プロキシ
---
    npm config set proxy http://username:password@hostname:port

cygwin/shell プロキシ
---
- 一時

    export http_proxy=http://username:password@hostname:port

- 永久：　.bashrcに追加

    vim ~/.bashrc

    export http_proxy=http://username:password@hostname:port

- Hostを無視する場合：

    export no_proxy=localhost,127.0.0.0/8,127.0.1.1,127.0.1.1*,local.home



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 プロキシ
---
http://stackoverflow.com/questions/1491180/how-to-configure-a-http-proxy-for-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行目の&lt;proxy&gt;節のコメントアウトを外す：

        <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