我目前正在尝试为从一个Tomcat服务器运行的两个独立应用程序设置两个子域,我很难实现它。
如果没有子域,我可以配置一个具有两个挂载点的VirtualHost,并且能够以这种方式获取应用程序(看起来像http:// url / confluence),但这不是最佳的。
我的设置如下:
这是我的httpd.conf设置
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogLevel info
NameVirtualHost *:80
<VirtualHost *:80>
ServerName youtrack.url.com
ServerAlias www.youtrack.url.com
JkMount /youtrack* tomcat
DocumentRoot /var/www/html/youtrack
</VirtualHost>
<VirtualHost *:80>
ServerName confluence.url.com
ServerAlias www.confluence.url.com
JkMount /confluence* tomcat
DocumentRoot /var/www/html/confluence
</VirtualHost>
这是我的workers.properties
worker.list=tomcat
worker.tomcat.host=localhost
worker.tomcat.port=8009
worker.tomcat.type=ajp13
似乎正在发生的事情是我点击了每个子域的DocumentRoot,但是当我删除DocumentRoot时,它永远不会转移到Tomcat Web应用程序。
寻求帮助,谢谢。
更新 - 这是mod_jk日志
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/favicon.ico' from 2 maps
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] find_match::jk_uri_worker_map.c (945): Attempting to map context URI '/confluence/=confluence' source 'JkMount'
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] find_match::jk_uri_worker_map.c (945): Attempting to map context URI '/confluence=confluence' source 'JkMount'
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] jk_translate::mod_jk.c (3723): no match for /favicon.ico found
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/favicon.ico' from 2 maps
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] find_match::jk_uri_worker_map.c (945): Attempting to map context URI '/confluence/=confluence' source 'JkMount'
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] find_match::jk_uri_worker_map.c (945): Attempting to map context URI '/confluence=confluence' source 'JkMount'
[Mon Aug 19 15:14:37.011 2013] [26577:139706593232864] [debug] jk_map_to_storage::mod_jk.c (3798): no match for /favicon.ico found
答案 0 :(得分:5)
将此添加到您的Apache Web服务器配置:
<VirtualHost youtrack.url.com:80>
ServerName youtrack.url.com
JkMount / tomcat
JkMount /* tomcat
</VirtualHost>
<VirtualHost confluence.url.com:80>
ServerName confluence.url.com
JkMount / tomcat
JkMount /* tomcat
</VirtualHost>
这是你的Tomcats server.xml:
对于单个webapps目录(使用其域名部署的应用程序,请参阅“docbase”):
<Host name="youtrack.url.com" appBase="webapps">
<Context path="" docBase="youtrack"/>
</Host>
<Host name="confluence.url.com" appBase="webapps">
<Context path="" docBase="confluence"/>
</Host>
对于单独的webapps目录(部署为“ROOT”的应用程序):
<Host name="youtrack.url.com" appBase="ABSOLUTE_PATH\youtrack-webapps" autoDeploy="true" unpackWARs="true" />
<Host name="confluence.url.com" appBase="ABSOLUTE_PATH\confluence-webapps" autoDeploy="true" unpackWARs="true" />