Apache / Tomcat中的多个子域名,带有mod_jk

时间:2021-12-10 14:03:27

I am currently trying to setup two subdomains for two separate applications running from one Tomcat server and I am having a hard time getting it going.

我目前正在尝试为从一个Tomcat服务器运行的两个独立应用程序设置两个子域,我很难实现它。

Without the subdomains I am able to configure one VirtualHost with two mount points and able to get at the applications that way ( looks like http:// url/confluence ) but this is not optimal.

如果没有子域,我可以配置一个具有两个挂载点的VirtualHost并且能够以这种方式获取应用程序(看起来像http:// url / confluence),但这不是最佳的。

My set up is as follows:

我的设置如下:

  • Subdomain - youtrack.url.com
  • 子域名 - youtrack.url.com
  • Subdomain - confluence.url.com
  • 子域名 - confluence.url.com
  • Tomcat7 running two war files with the context paths of /confluence and /youtrack
  • Tomcat7运行两个war文件,其上下文路径为/ confluence和/ youtrack
  • Apache 2 running mod_jk against tomcat instance
  • Apache 2针对tomcat实例运行mod_jk

Here is my httpd.conf setup

这是我的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>

Here is my workers.properties

这是我的workers.properties

worker.list=tomcat

worker.tomcat.host=localhost
worker.tomcat.port=8009
worker.tomcat.type=ajp13

What appears to be happening is that I hit the DocumentRoot of each subdomain but when I remove the DocumentRoot it never makes it over to the Tomcat web app.

似乎正在发生的事情是我点击了每个子域的DocumentRoot,但是当我删除DocumentRoot时,它永远不会转到Tomcat Web应用程序。

Looking for some help, Thanks.

寻求帮助,谢谢。

Updated - here is the mod_jk log

更新 - 这是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

1 个解决方案

#1


5  

Add this to your Apache web server config:

将此添加到您的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>

And this to your Tomcats server.xml:

这是你的Tomcats server.xml:

For a single webapps directory (applications deployed with their domain names, see "docbase"):

对于单个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>

For separate webapps directories (applications deployed as "ROOT"):

对于单独的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" />

#1


5  

Add this to your Apache web server config:

将此添加到您的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>

And this to your Tomcats server.xml:

这是你的Tomcats server.xml:

For a single webapps directory (applications deployed with their domain names, see "docbase"):

对于单个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>

For separate webapps directories (applications deployed as "ROOT"):

对于单独的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" />