Apache 2.4 Tomcat7和mod_jk

时间:2014-06-13 09:35:34

标签: apache tomcat7 mod-jk

我想将apache2.4与tomcat7连接

我的配置是:

workers.properties

    workers.tomcat_home=/var/lib/tomcat7
workers.java_home=/usr/lib/jvm/java-7-oracle
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=domain.com
worker.worker1.port=8009

在jk.conf中:

    JkWorkersFile /etc/apache2/workers.properties
JkLogStampFormat "[%b %d %Y - %H:%M:%S] "
JkRequestLogFormat "%w %V %T"
#JkAutoAlias /var/lib/tomcat7/webapps
#JkMountCopy All
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkMount /ROOT/ worker1
JkMount /ROOT/* worker1

当我重新开始使用apache时出现错误:

    [Jun 13 2014 - 11:32:50] [23256:140183177717632] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Jun 13 2014 - 11:32:50] [23256:140183177717632] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-manager' in uri map post processing.
[Jun 13 2014 - 11:32:50] [23256:140183177717632] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-status' in uri map post processing.
[Jun 13 2014 - 11:32:50] [23257:140183177717632] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Jun 13 2014 - 11:32:50] [23257:140183177717632] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-manager' in uri map post processing.
[Jun 13 2014 - 11:32:50] [23257:140183177717632] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-status' in uri map post processing.

你知道出了什么问题吗?

我无法打开应用程序,我有空页。

2 个答案:

答案 0 :(得分:3)

除非您想启用mod的管理,否则您可以忽略引用'jk-manager'和'jk-status'的错误。 您需要将JK mount指令移动到网站的VirtualHost部分。您可以将以下内容添加到/etc/apache2/sites-available/default

  

<VirtualHost *:80> ... # Send everything for /* to worker1 JkMount /* worker1 ... </VirtualHost>

答案 1 :(得分:3)

看起来您可能错过了jk-managerjk-status的配置。您只需将它们写入workers.properties文件即可。 (如果你没有tomcat管理包,我相信你需要它。如果你不想安装任何东西,只需查看本文底部的'替代'部分。)

如果找不到workers.properties文件,请查看您的apache配置,例如:grep -r JkWorkersFile /etc/apache2。配置应包含以下内容,表示workers.properties文件的路径:

<IfModule jk_module>
    JkWorkersFile /etc/libapache2-mod-jk/workers.properties
    # ...
</IfModule>

workers.properties文件中

确保您拥有以下内容或类似内容:

# configure jk-status
worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true
# configure jk-manager
worker.list=jk-manager
worker.jk-manager.type=status

替代地

或者,您可以从Apache配置中删除定义jk-manager和jk-status的XML元素。