做Apache与tomcat基于mod_jk整合实验时,出现了错误(详细
配置过程:http://blog.chinaunix.net/uid-30212356-id-5718697.html)
先写下我的部分过程:
创建一个jk_mod.conf文件来写入jk配置:
[root@localhost extra]# pwd
/etc/httpd/conf/extra
[root@localhost extra]# vim jk_mod.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /etc/httpd/conf/extra/workers.properties
JkLogFile /var/log/httpd/mod_jk.log
JkLogLevel debug
JkMount /* tomcatA
JkMount /status/ stat1
创建对应的workers.properties文件
[root@localhost extra]# pwd
/etc/httpd/conf/extra
[root@localhost extra]# vim workers.properties
worker.list=tomcatA,stat1
worker.tomcatA.type=ajp13
worker.tomcatA.port=80
worker.tomcat.host=192.168.85.129
worker.tomcatA.lbfactor=1
worker.stat1.type=status
然后编辑主配置文件,添加:
Include conf/extra/jk_mod.conf
Include conf/extra/workers.properties
检查语法时出现错误:
error on line 1 of /etc/httpd/conf/extra/workers.properties:
Invalid command 'worker.list=tomcatA', perhaps misspelled or defined by a module not included in the server configuration
找了好多资料,也没解决问题,后来仔细想了想,Apache启动时会加载httpd.conf文件和Include的文件如jk_module.conf,而jk_module.conf文件中又定义了
JkWorkersFile为/etc/httpd/conf/extra/workers.properties,也就是说是
jk_module.conf去主动加载workers.properties文件,而不是要httpd.conf去加载,所以会出现Invalid command错误。
抱着这个想法,我将主配置文件httpd.conf中的
Include conf/extra/workers.properties一项注释,只留下Include conf/extra/jk_mod.conf,然后检查语法,果然不报错了,重启后功能如期正常运行。
当初自己大意加上了
Include conf/extra/workers.properties项,也没有想到错误会出现在这,真是一个教训啊!
阅读(1262) | 评论(0) | 转发(0) |