Tomcat:反向代理需要哪些服务器 .xml 连接器?

Tomcat: what server.xml connectors are required for a reverse proxy?

提问人:QF0 提问时间:11/13/2023 更新时间:11/13/2023 访问量:22

问:

我在端口 8080 上有一个有效的 Tomcat 应用程序 (Alfresco),我需要在端口 443 上运行,从 Apache 转发(Apache 已经在此服务器上处理了许多其他 SSL 端点)。

这有效,但我不太明白为什么。我的设置是:

  1. Apache 与 .连接器处理以前显式位于端口 8080 上的 URL 和 。 设置为转发到端口 8009mod_jkhttps://example.com/alfrescohttps://example.com/shareworker.properties
  2. Tomcat 包含以下连接器定义:server.xml
 <!-- Question: what is this for? -->
 <Connector port="8080" protocol="HTTP/1.1"
        URIEncoding="UTF-8" connectionTimeout="20000"
        maxHttpHeaderSize="32768" redirectPort="8443"
        enableLookups="false" xpoweredBy="false" server="AlfrescoECM"
        maxParameterCount="1000"/>

<!-- Alfresco requires an HTTPS connection to Solr on port 8443 -->
<Connector port="8443" protocol="HTTP/1.1"
               SSLEnabled="true" maxThreads="150" scheme="https"
               ... 
               sslProtocol="TLS" />

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector protocol="AJP/1.3"
           port="8009" redirectPort="8443"
           maxParameterCount="1000" secretRequired="false" />

如果我省略端口 8080 的连接器,这将不起作用:

 INFO  [webscripts.connector.RemoteClient] [ajp-nio-127.0.0.1-8009-exec-3] Exception calling (GET) http://localhost:8080/alfresco/s/api/admin/restrictions?guest=true
org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1] failed: Connection refused
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:156) ~[httpclient-4.5.13.jar:4.5.13]
...
Caused by: java.net.ConnectException: Connection refused

问:为什么我仍然需要端口 8080 的连接器?这一切不应该由AJP处理吗?

Tomcat Alfresco AJP

评论

1赞 user207421 11/13/2023
您的 Apache 配置是什么样的?mod_jk

答: 暂无答案