带有mod_jk的apache2 tomcat7在系统重启后不起作用

时间:2014-09-22 15:32:56

标签: apache2 tomcat7 mod-jk ajp

我已经将tomcat配置为使用apache2和mod_jk在端口80上运行,这很有效。如果我重新启动系统,那么该站点将成为apache2的标准站点。如果我重新启动apache2(/etc/init.d/apache2 restart),该站点将来自tomcat。但是为什么在重启apache2之后首先要做什么?

有人有想法吗?

重启系统后记录(在/ var / log / apache2 /中):

> mod_jk.log <
[Mon Sep 22 16:24:40.296 2014] [2256:3075069696] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Mon Sep 22 16:24:40.296 2014] [2256:3075069696] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-manager' in uri map post processing.
[Mon Sep 22 16:24:40.296 2014] [2256:3075069696] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-status' in uri map post processing.
[Mon Sep 22 16:24:40.298 2014] [2257:3075069696] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Mon Sep 22 16:24:40.298 2014] [2257:3075069696] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-manager' in uri map post processing.
[Mon Sep 22 16:24:40.298 2014] [2257:3075069696] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-status' in uri map post processing.

> error.log <
[Mon Sep 22 16:24:40 2014] [notice] Apache/2.2.22 (Debian) mod_jk/1.2.37 configured -- resuming normal operations
[Mon Sep 22 16:26:50 2014] [notice] caught SIGTERM, shutting down

重新启动apache后的日志(在/ var / log / apache2 /中):

> mod_jk.log <
[Mon Sep 22 16:29:10.042 2014] [3599:3074443008] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Mon Sep 22 16:29:10.042 2014] [3599:3074443008] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-manager' in uri map post processing.
[Mon Sep 22 16:29:10.042 2014] [3599:3074443008] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-status' in uri map post processing.
[Mon Sep 22 16:29:10.052 2014] [3600:3074443008] [info] init_jk::mod_jk.c (3365): mod_jk/1.2.37 initialized
[Mon Sep 22 16:29:10.052 2014] [3600:3074443008] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-manager' in uri map post processing.
[Mon Sep 22 16:29:10.052 2014] [3600:3074443008] [error] extension_fix::jk_uri_worker_map.c (564): Could not find worker with name 'jk-status' in uri map post processing.

> error.log <
[Mon Sep 22 16:29:10 2014] [notice] Apache/2.2.22 (Debian) mod_jk/1.2.37 configured -- resuming normal operations

编辑1: 好的,我已经多次测试了一下,发现apache2 / tomcat7 / mod_jk的行为更疯狂xD 我会告诉你我的配置:

> local: hosts <
192.168.84.129 migor
192.168.84.129 test.migor

> in tomcat server.xml <
<Host name="test.migor" appBase="myapps/test" unpackWARs="true" autoDeploy="true" />

> worker.properties <
workers.tomcat_home=/var/lib/tomcat7
workers.java_home=/usr/lib/jvm/java-7
ps=/
worker.list=ajp13_worker
worker.ajp13_worker.port=8009
worker.ajp13_worker.host=localhost
worker.ajp13_worker.type=ajp13
worker.ajp13_worker.lbfactor=1

> sitea-available/test.migor <
<Virtualhost test.migor>
    JkMount /* ajp13_worker
    ServerName test.migor
    DocumentRoot /var/lib/tomcat7/myapps/test
    ErrorLog /var/lib/tomcat7/logs/error.log
    CustomLog /var/lib/tomcat7/logs/access.log common
    <Directory /var/lib/tomcat7/myapps/test>
        Options -Indexes
    </Directory>
</Virtualhost>

现在行为:

  • 在网址重新启动后:“test.migor /”,“migor /”和我的服务器ip 192.168.84.129我将从apache2获取该网站
  • 重新启动apache2后,我将从webapps和test.migor / myapps / test页面获取migor /和192.168.84.129 tomcat页面。这里的问题,我预计在192.168.84.129页面来自apache2。

有什么想法吗?

编辑2:

好的,我忘记将“NameVirtualHost test.migor”添加到“sitea-available / test.migor”,我的配置完全覆盖默认的apache设置。现在对我来说行为还可以。使用url“migor /”我可以调用默认的apache站点,并使用url“test.migor /”我可以调用tomcat7 / myapps / test中的tomcat主页。

但是这种行为只有在重新启动apache2后才会被激活(如果我之前重新启动了我的系统)。我将展示解决方案并在此处发布。也许在“编辑3”xD

1 个答案:

答案 0 :(得分:0)

错误清楚地表明在workers.property文件中没有准确定义jk-managerjk-status

请检查您的workers.properties文件并进行以下更改:

worker.list=jk-manager
worker.jk-manager.type=status

worker.list=jk-status
worker.jk-status.type=status
worker.jk-status.read_only=true

干杯!!