我想使用连接器通过Apache网络服务器访问Tomcat。我坚持使用文档:http : //tomcat.apache.org/connectors-doc/generic_howto/quick.html 我只对其进行了少许修改,以匹配Debian-(Squeeze)-System上使用的目录结构。
因此,我将以下内容添加到/etc/apache2/httpd.conf中:
# Load mod_jk module
# Update this path to match your modules location
#LoadModule jk_module libexec/mod_jk.so
# Declare the module for <IfModule directive> (remove this line on Apache 2.x)
#AddModule mod_jk.c
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile /etc/apache2/workers.properties
# Where to put jk shared memory
# Update this path to match your local state directory or logs directory
JkShmFile /var/log/apache2/mod_jk.shm
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile /var/log/apache2/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the timestamp log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /tomcat7/* worker1
我注释掉了模块的加载,因为在通过软件包系统(libapache2-mod-jk)安装mod_jk之后已经发生了。
我的worker.properties看起来像这样:
# Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
Tomcat 7是直接从Apache的归档文件中安装的,因为它不是Squeeze中的软件包。Tomcat 7在其自己的端口(8180,不会与软件包系统中的tomcat6发生冲突)下运行并可访问。据我了解,我现在应该看到带有http:// host / tomcat7 /的tomcat站点。但是我却得到了404。怎么了?
在量子提示设置日志级别以进行调试(谢谢)后,我这样做了,并在mod_jk.log中发现了以下错误消息:'jk_map_to_storage :: mod_jk.c(3585):缺少176.9.9.55:/tomcat7的uri映射/'。我用谷歌搜索并找到http://old.nabble.com/mod_jk%2C-missing-uri-map-td23984359.html
因此,在VirtualHosts中未使用httpd.conf中设置的选项。我在VirtualHost中添加了“ JkMountCopy On”-首先获得了Tomcat 404(而不是httpd 404)。这里的问题是,他尝试访问安装的完全相同的URI,因此在我的情况下是/ tomcat7。我改用webapp的名称作为mount,对我来说一切都很好。