tomcat 7.0.23无法从apache服务器建立SSL连接。

时间:2011-12-12 03:25:03

标签: tomcat ssl proxy cluster-computing

您好我有以下server.xml设置。

Server port="7005" shutdown="SHUTDOWN-TOMCAT-C">
    <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
    <Listener className="org.apache.catalina.core.JasperListener" />
    <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
   <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

    <Service name="Catalina">
        <Connector port="7070" protocol="org.apache.coyote.http11.Http11NioProtocol" 
                   connectionTimeout="20000" 
                   redirectPort="7443" />
        <Connector port="7443" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" 
                   SSLEnabled="true" scheme="https" secure="true" clientAuth="want" sslProtocol="TLS" 
                   keystoreFile="${key.path}\compresskey.bin" keystorePass="${keystorePass}" 
                   compression="on" compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css"/>
        <Connector port="7009" protocol="org.apache.coyote.ajp.AjpProtocol" redirectPort="7443" enableLookups="false"  />

        <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat-c">
            <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
                     channelSendOptions="10">
                <Manager className="org.apache.catalina.ha.session.BackupManager"
                       expireSessionsOnShutdown="false"
                       notifyListenersOnReplication="true"
                       mapSendOptions="10"/>
                <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
                         filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                <ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
            </Cluster>

<Context path="/mvc2_app1"
                      docBase="${user.home}\webapps\mvc2_app1"
                      cookies="true"
                      override="true"
                      reloadable="false"
                      swallowOutput="true"
                      distributable="true"
                      logEffectiveWebXml="true"
                      xmlNamespaceAware="false"
                      xmlValidation="false"
                      className="org.apache.catalina.core.StandardContext">
</context>
</service>

</host>

my worker.properties

worker.tomcat-c.port=7009
worker.tomcat-c.host=localhost
worker.tomcat-c.type=ajp13
worker.tomcat-c.lbfactor=1

这是我的httpd.conf设置。

<VirtualHost ${host}:443> 
SSLEngine On ServerName ${host} 
ErrorLog "logs/error.log" 
LogLevel warn 
SSLCertificateFile conf/ssl/server.crt 
SSLCertificateKeyFile conf/ssl/server.key 
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown 
SSLProxyEngine On 
ServerAdmin local@admin.com 
RewriteEngine On 

ProxyPreserveHost On #applications on 5443 
ProxyPass /mvc2_app1 https://${host}:7443/mvc2_app1 

ProxyPassReverse /mvc2_app1 https://${host}:7443/mvc2_app1 
</virtual_host>

当我尝试连接到https://localhost/mvc2_app1时,出现错误500代理错误。

这是我的error.log     proxy:/ mvc2_app1返回的远程服务器SSL握手期间出错     代理:传递请求正文失败到$ {local ip}:7443($ {host})来自$ {local ip}

任何建议或提示?

感谢。

- 更新 - 我可以毫无问题地连接到apache服务器。 https://localhost有效但https://localhost/mvc2_app1没有。

所以我的tomcat日志就是这个。

Dec 25, 2011 10:21:57 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-7070"]
Dec 25, 2011 10:21:57 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Dec 25, 2011 10:21:57 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-7443"]
Dec 25, 2011 10:21:58 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
Dec 25, 2011 10:21:58 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-7009"]
    Dec 25, 2011 10:21:58 PM org.apache.catalina.tribes.membership.McastServiceImpl setupSocket
    INFO: Setting cluster mcast soTimeout to 500
    Dec 25, 2011 10:21:58 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
    INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:4
    Dec 25, 2011 10:21:59 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
    INFO: Done sleeping, membership established, start level:4
    Dec 25, 2011 10:21:59 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
    INFO: Sleeping for 1000 milliseconds to establish cluster membership, start level:8
    Dec 25, 2011 10:22:00 PM org.apache.catalina.tribes.membership.McastServiceImpl waitForMembers
    INFO: Done sleeping, membership established, start level:8
    Dec 25, 2011 10:22:00 PM org.apache.catalina.tribes.tipis.AbstractReplicatedMap init
    INFO: Initializing AbstractReplicatedMap with context name:/mvc2_app1
    Dec 25, 2011 10:22:00 PM org.apache.catalina.tribes.tipis.AbstractReplicatedMap init
    INFO: Initializing AbstractReplicatedMap with context name:/mvc2_app2

2 个答案:

答案 0 :(得分:1)

您正在混淆mod_jkmod_proxy

worker.properties参数适用于使用AJP的mod_jk,但mod_proxy_ajp并未使用它们(现在推荐使用mod_jk进行AJP连接)。

您的ProxyPassReverse配置使用mod_proxy_httphttps://网址,而不是ajp://),而不是mod_jkmod_proxy_ajp。在Tomcat上为此启用AJP并没有什么意义。

您可能不需要在Apache Httpd服务器和Apache Tomcat服务器之间使用HTTPS(从localhost到localhost)。但是,如果您认为有必要,请使用SSLProxy*指令顶部提到的{{1}}指令。

答案 1 :(得分:0)

所以我更新到tomcat 7.0.25并运行我的应用程序。我至少在我的spring 3应用程序中看到了配置错误,并且能够修复它们。

相关问题