# プロキシサーバーを使用するようTomcatを設定

## 手順

1. Tomcatサーバーを停止します。
2. 設定を完了させます。設定ファイルは&lt;TomcatPath&gt;/bin/setenv.shです。このファイルが存在しない場合は作成します。
3. 次のパラメーターを追加し、設定に一致するよう変更します:
   ```
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyHost=proxy.server.com # Specify the host name or IP address of your HTTP proxy server. You can use this parameter for http and https host names.
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyPort=YourHttpProxyPort # Specify the port number of your proxy server.
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1" # Specify a list of hosts separated by "|" that do not require access through your proxy server.
   ```

   例:
   ```
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyHost=proxy.server.com 
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.proxyPort=3128
   CATALINA_OPTS=$CATALINA_OPTS -Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1"
   ```

   認証付きプロキシを使用する場合は、&lt;tomcat\_path&gt;/WEB-INF/configuration.propertiesファイルに移動して以下の行をコメント解除します。
   * 認証付きプロトコル:
     ```
     #http.proxyUser=someuser
     #http.proxyPassword=somepassword
     ```
   * 認証付きHTTPSプロトコル:
     ```
     #https.proxyUser=someuser
     #https.proxyPassword=somepassword
     ```

   プロキシ設定の詳細は、https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.htmlをご覧ください。
4. Tomcatサーバーを再起動します。