跳到主要内容 跳到补充内容

配置 Tomcat 使用代理服务器

步骤

  1. 停止 Tomcat 服务器。
  2. 根据 Talend Administration Center 运行方式设置配置:
    • 如果您将 Talend Administration Center 作为服务器模块运行。
      1. 转到 <TomcatPath>\bin,并编辑 setenv.bat 文件。如果该文件不存在,则创建它。
      2. 添加以下参数,即可更改参数以匹配配置:
        set 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.
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyPort=YourHttpProxyPort # Specify the port number of your proxy server.
        set 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.
        例如:
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyHost=proxy.server.com 
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.proxyPort=3128
        set CATALINA_OPTS=%CATALINA_OPTS% -Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1"
      3. 如果您在使用需要认证的代理,打开 <tomcat_path>/WEB-INF/classes/configuration.properties 文件并取消下列各行的注释:
        • 基于 HTTP 协议的代理:
          #http.proxyUser=someuser
          #http.proxyPassword=somepassword
        • 基于 HTTPS 协议的代理:
          #https.proxyUser=someuser
          #https.proxyPassword=somepassword
    • 如果将 Talend Administration Center 作为 Windows 服务运行,则使用 Windows 命令提示符更改 Java 属性:
      1. 运行以下命令:
        <tomcat_directory>\bin\tomcat9w.exe //ES//talend-tac-x.x.x ++JvmOptions=-Dhttp.proxyHost=proxy.server.com
        <tomcat_directory>\bin\tomcat9w.exe //ES//talend-tac-x.x.x ++JvmOptions=-Dhttp.proxyPort=YourHttpProxyPort
        <tomcat_directory>\bin\tomcat9w.exe //ES//talend-tac-x.x.x ++JvmOptions=-Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1" 
        例如:
        C:\Talend\7.3.1\tac\apache-tomcat\bin\tomcat9w.exe //ES//talend-tac-7.3.1 ++JvmOptions=-Dhttp.proxyHost=proxy.server.com
        C:\Talend\7.3.1\tac\apache-tomcat\bin\tomcat9w.exe //ES//talend-tac-7.3.1 ++JvmOptions=-Dhttp.proxyPort=3128
        C:\Talend\7.3.1\tac\apache-tomcat\bin\tomcat9w.exe //ES//tvalend-tac-7.3.1 ++JvmOptions=-Dhttp.nonProxyHosts="localhost|host.mydomain.com|192.168.0.1" 
    有关代理配置的更多信息,请参阅https://docs.oracle.com/javase/8/docs/technotes/guides/net/proxies.html
  3. 重新启动 Tomcat 服务器。

本页面有帮助吗?

如果您发现此页面或其内容有任何问题 – 打字错误、遗漏步骤或技术错误 – 请告诉我们如何改进!