带有SSL和客户端证书的Apache httpd后面的Tomcat

我尝试在本地win32机器上评估客户的基础架构。 基础架构应该基于运行在tomcat(6.0.20 +)上的j2ee webapp,位于secur apache httpd(httpd-2.2.16 / openssl-0.9.8)之后,它只转发那些被授权的请求证书)。

我的方法是用mod_jk和相应的ajp13协议解决tomcat和apache之间的连接。 tomcat(ajp13)在端口8099上运行,我configuration了workers.properties和我的mod_jk.conf (并将其包含在httpd.conf )。 连接工作成功。 httpd在端口80上运行,tomcat在8084下运行他的http端口。 向http://localhost/my-webapp-context发送http请求时。 tomcats回答并显示我的webapp。

到目前为止,有以下configuration文件:

mod_jk.conf

 LoadModule jk_module modules/mod_jk.so #LoadModule ssl_module modules/mod_ssl.so JkWorkersFile conf/workers.properties JkShmFile logs/httpd/mod_jk.shm JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkMount /* balancer 

workers.properties

 worker.list=jk-status worker.jk-status.type=status worker.jk-status.read_only=true worker.list=jk-manager worker.jk-manager.type=status worker.list=balancer worker.balancer.type=lb worker.balancer.error_escalation_time=0 worker.balancer.max_reply_timeouts=10 worker.balancer.balance_workers=node1 worker.node1.reference=worker.template worker.node1.host=localhost worker.node1.port=8109 worker.node1.activation=A worker.balancer.balance_workers=node2 worker.node2.reference=worker.template worker.node2.host=localhost worker.node2.port=8099 worker.node2.activation=A worker.template.type=ajp13 worker.template.socket_connect_timeout=5000 worker.template.socket_keepalive=true worker.template.ping_mode=A worker.template.ping_timeout=10000 worker.template.connection_pool_minsize=0 worker.template.connection_pool_timeout=600 worker.template.reply_timeout=300000 worker.template.recovery_options=3 

如上所述,这就像一个魅力,现在我读了几个SSL教程。 我已经创build了一个server.key (没有私钥,因为这在win32平台上似乎失败了)以及经本地authentication机构authentication的server.cer

当涉及到启用mod_ssl我得到几个错误。 我尝试了以下configuration:

 <VirtualHost *:443> SSLEngine On SSLCertificateFile conf/server.cer SSLCertificateKeyFile conf/server.key </VirtualHost> 

有了这个configuration,我产生了即将发生的错误(CN是我在计算机上的计算机名称),这也是我在生成authentication时提供的价值。 Apache拒绝启动这个configuration,并显示我列出的错误。

更新

现在我终于得到了运行ssl和客户端证书的apache:

mod_jk_ssl.conf

 LoadModule jk_module modules/mod_jk.so LoadModule ssl_module modules/mod_ssl.so JkWorkersFile conf/workers.properties JkShmFile logs/httpd/mod_jk.shm JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " Listen 443 <VirtualHost *:443> JkMount /* balancer SSLEngine On SSLCertificateFile conf/web.crt SSLCertificateKeyFile conf/web.key SSLCACertificateFile conf/exampleCA.crt SSLVerifyClient require SSLVerifyDepth 2 <IfDefine SSL> SSLRequireSSL SSLRequire %{SSL_CLIENT_S_DN_O} eq "certification-authority" and %{SSL_CLIENT_S_DN_OU} in {"BALVI"} </IfDefine> </VirtualHost> 

船长明显在这里。 你确实给了我的电脑名称 ,包括域名? 如果没有,再次重新创build密钥。

你总是可以添加一个redirect到Apache,让你直接到你的Web应用程序

RedirectMatch ^ /(。)/ $ http://host.domain.com/your-webapp-context/