You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Moritz Winter <mo...@googlemail.com> on 2010/07/27 15:40:51 UTC
mod_jk and tomcat virtual hosts not connecting
Hi, First of all I would like to mention that this is my first post on
this list, I hope that this question is sent in the right place.
I have tried finding a solution for my problem, but it either doesn't
exist, or my limited brain can't manage to figure out how to do it (I
strongly hope it is the latter).
My issue is with the mod_jk plugin. I want to redirect my subdomain
requests jira.example.com to a tomcat 6 virtual host called jiraapp. If
I call the subdomain jira.example.com Im always getting the default
tomcat 6 host called localhost.
I tested every part:
1.) mod_jk: if i change the workers name in either workers.properties or
und er my enabled-site <VirtualHost> or if i change the mapping to my
virtual host (/etc/hosts: 127.0.0.1 localhost jiraapp) apache doesnt
start. So I think this should work and is configured right.
2.) if I do a lynx jiraapp:8080 on the machine it works and shows the
right webapp.
But if I access jira.example.com I always getting the default
root-webapp of tomcat 6. So theres no difference in calling
jira.example.com or example.com:8080. In general my setup looks like this:
1.) browse to jira.example.com
2.) apache <VirtualHost> hands over to mod_jk
3.) mod_jk redirects to worker.jiraworker.host:worker.jiraworker.port
(jiraa pp:8009) via ajp
4.) jiraapp resolves to 127.0.0.1 trough /etc/hosts
5.) tomcat relays to the jiraapp name based virtual host
Do I miss something here? My guess would be that iam doing something
wrong in step 4 because i can call lynx jiraapp on the local bash (5)
and i can access the default virtual host from remote (1-3).
Help would be appreciated.
Versions:
Apache Tomcat/6.0.29
Sun-Java 1.6.0_20-b02
Apache/2.2.9 (Debian) mod_jk/1.2.26 proxy_html/3.0.0 Server
libapache2-mod-jk 1:1.2.26-2+lenny1
== jk.load ==
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
# JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
-ForwardLocalAddress
JkRequestLogFormat "%w %V %T"
== workers.properties ==
workers.tomcat_home=/opt/tomcat
workers.java_home=/usr/lib/jvm/java-6-sun
worker.list=jiraworker
worker.jiraworker.port=8009
worker.jiraworker.host=jiraapp
worker.jiraworker.type=ajp13
== /etc/hosts ==
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.0.1 localhost.localdomain localhost jiraapp
== server.xml ===
<Engine name="Catalina" defaultHost="localhost">
[...]
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
[...]
</Host>
<Host name="jiraapp" appBase="jiraapp" docBase="/opt/tomcat/jiraapp"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false" >
== apache example.com virtual hosts configuration file ==
<VirtualHost *:80>
ServerName www.jira.example.com
ServerAlias jira.example.com
JkMount /* jiraworker
</VirtualHost>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk and tomcat virtual hosts not connecting
Posted by Moritz Winter <mo...@googlemail.com>.
Hi Felix,
youre absolutely right and it works like a charm, thank you so much!!
Vielen Dank ;-)
Btw. the www prefix is just working fine if I add the alias to the
tomcat server.xml!
Greetings!
Am 27.07.2010 17:55, schrieb Felix Schumacher:
> Hi Moritz,
>
> Am Dienstag, den 27.07.2010, 15:40 +0200 schrieb Moritz Winter:
>
>> My issue is with the mod_jk plugin. I want to redirect my subdomain
>> requests jira.example.com to a tomcat 6 virtual host called jiraapp. If
>> I call the subdomain jira.example.com Im always getting the default
>> tomcat 6 host called localhost.
> I think your problem is, that mod_jk doesn't change the hostname of the
> original request. So name your virtual host in tomcat jira.example.com
> instead of jiraapp.
>
>> I tested every part:
>> 1.) mod_jk: if i change the workers name in either workers.properties or
>> und er my enabled-site<VirtualHost> or if i change the mapping to my
>> virtual host (/etc/hosts: 127.0.0.1 localhost jiraapp) apache doesnt
>> start. So I think this should work and is configured right.
>> 2.) if I do a lynx jiraapp:8080 on the machine it works and shows the
>> right webapp.
>>
>> But if I access jira.example.com I always getting the default
>> root-webapp of tomcat 6. So theres no difference in calling
>> jira.example.com or example.com:8080. In general my setup looks like this:
>> 1.) browse to jira.example.com
>> 2.) apache<VirtualHost> hands over to mod_jk
>> 3.) mod_jk redirects to worker.jiraworker.host:worker.jiraworker.port
>> (jiraa pp:8009) via ajp
>> 4.) jiraapp resolves to 127.0.0.1 trough /etc/hosts
>> 5.) tomcat relays to the jiraapp name based virtual host
>>
>> Do I miss something here? My guess would be that iam doing something
>> wrong in step 4 because i can call lynx jiraapp on the local bash (5)
>> and i can access the default virtual host from remote (1-3).
>>
>> Help would be appreciated.
>>
>> Versions:
>> Apache Tomcat/6.0.29
>> Sun-Java 1.6.0_20-b02
>> Apache/2.2.9 (Debian) mod_jk/1.2.26 proxy_html/3.0.0 Server
>> libapache2-mod-jk 1:1.2.26-2+lenny1
>>
>> == jk.load ==
>>
>> LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
>> JkWorkersFile /etc/apache2/workers.properties
>> JkLogFile /var/log/apache2/mod_jk.log
>> JkLogLevel info
>> # JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
>> -ForwardLocalAddress
>> JkRequestLogFormat "%w %V %T"
>>
>>
>> == workers.properties ==
>>
>> workers.tomcat_home=/opt/tomcat
>> workers.java_home=/usr/lib/jvm/java-6-sun
> I don't think that you need tomcat_home or java_home in your setup.
>
>> worker.list=jiraworker
>> worker.jiraworker.port=8009
>> worker.jiraworker.host=jiraapp
>> worker.jiraworker.type=ajp13
>>
>>
>> == /etc/hosts ==
>>
>> ::1 localhost ip6-localhost ip6-loopback
>> fe00::0 ip6-localnet
>> ff00::0 ip6-mcastprefix
>> ff02::1 ip6-allnodes
>> ff02::2 ip6-allrouters
>> ff02::3 ip6-allhosts
>> 127.0.0.1 localhost.localdomain localhost jiraapp
>>
>>
>> == server.xml ===
>>
>> <Engine name="Catalina" defaultHost="localhost">
>> [...]
>> <Host name="localhost" appBase="webapps"
>> unpackWARs="true" autoDeploy="true"
>> xmlValidation="false" xmlNamespaceAware="false">
>> [...]
>> </Host>
>> <Host name="jiraapp" appBase="jiraapp" docBase="/opt/tomcat/jiraapp"
>> unpackWARs="true" autoDeploy="true"
>> xmlValidation="false" xmlNamespaceAware="false">
>>
>> == apache example.com virtual hosts configuration file ==
>> <VirtualHost *:80>
>> ServerName www.jira.example.com
>> ServerAlias jira.example.com
> I don't know what happens if you access your server through
> www.jira.example.com. I think you will find, that your default tomcat
> virtual host will be called instead of jira.example.com.
>
> You will probably want to redirect users to jira.example.com in that
> case.
>
> Bye Felix
>
>> JkMount /* jiraworker
>> </VirtualHost>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: mod_jk and tomcat virtual hosts not connecting
Posted by Felix Schumacher <fe...@internetallee.de>.
Hi Moritz,
Am Dienstag, den 27.07.2010, 15:40 +0200 schrieb Moritz Winter:
> My issue is with the mod_jk plugin. I want to redirect my subdomain
> requests jira.example.com to a tomcat 6 virtual host called jiraapp. If
> I call the subdomain jira.example.com Im always getting the default
> tomcat 6 host called localhost.
I think your problem is, that mod_jk doesn't change the hostname of the
original request. So name your virtual host in tomcat jira.example.com
instead of jiraapp.
>
> I tested every part:
> 1.) mod_jk: if i change the workers name in either workers.properties or
> und er my enabled-site <VirtualHost> or if i change the mapping to my
> virtual host (/etc/hosts: 127.0.0.1 localhost jiraapp) apache doesnt
> start. So I think this should work and is configured right.
> 2.) if I do a lynx jiraapp:8080 on the machine it works and shows the
> right webapp.
>
> But if I access jira.example.com I always getting the default
> root-webapp of tomcat 6. So theres no difference in calling
> jira.example.com or example.com:8080. In general my setup looks like this:
> 1.) browse to jira.example.com
> 2.) apache <VirtualHost> hands over to mod_jk
> 3.) mod_jk redirects to worker.jiraworker.host:worker.jiraworker.port
> (jiraa pp:8009) via ajp
> 4.) jiraapp resolves to 127.0.0.1 trough /etc/hosts
> 5.) tomcat relays to the jiraapp name based virtual host
>
> Do I miss something here? My guess would be that iam doing something
> wrong in step 4 because i can call lynx jiraapp on the local bash (5)
> and i can access the default virtual host from remote (1-3).
>
> Help would be appreciated.
>
> Versions:
> Apache Tomcat/6.0.29
> Sun-Java 1.6.0_20-b02
> Apache/2.2.9 (Debian) mod_jk/1.2.26 proxy_html/3.0.0 Server
> libapache2-mod-jk 1:1.2.26-2+lenny1
>
> == jk.load ==
>
> LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
> JkWorkersFile /etc/apache2/workers.properties
> JkLogFile /var/log/apache2/mod_jk.log
> JkLogLevel info
> # JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
> -ForwardLocalAddress
> JkRequestLogFormat "%w %V %T"
>
>
> == workers.properties ==
>
> workers.tomcat_home=/opt/tomcat
> workers.java_home=/usr/lib/jvm/java-6-sun
I don't think that you need tomcat_home or java_home in your setup.
> worker.list=jiraworker
> worker.jiraworker.port=8009
> worker.jiraworker.host=jiraapp
> worker.jiraworker.type=ajp13
>
>
> == /etc/hosts ==
>
> ::1 localhost ip6-localhost ip6-loopback
> fe00::0 ip6-localnet
> ff00::0 ip6-mcastprefix
> ff02::1 ip6-allnodes
> ff02::2 ip6-allrouters
> ff02::3 ip6-allhosts
> 127.0.0.1 localhost.localdomain localhost jiraapp
>
>
> == server.xml ===
>
> <Engine name="Catalina" defaultHost="localhost">
> [...]
> <Host name="localhost" appBase="webapps"
> unpackWARs="true" autoDeploy="true"
> xmlValidation="false" xmlNamespaceAware="false">
> [...]
> </Host>
> <Host name="jiraapp" appBase="jiraapp" docBase="/opt/tomcat/jiraapp"
> unpackWARs="true" autoDeploy="true"
> xmlValidation="false" xmlNamespaceAware="false" >
>
> == apache example.com virtual hosts configuration file ==
> <VirtualHost *:80>
> ServerName www.jira.example.com
> ServerAlias jira.example.com
I don't know what happens if you access your server through
www.jira.example.com. I think you will find, that your default tomcat
virtual host will be called instead of jira.example.com.
You will probably want to redirect users to jira.example.com in that
case.
Bye Felix
> JkMount /* jiraworker
> </VirtualHost>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: mod_jk and tomcat virtual hosts not connecting
Posted by Irfan Khan <ir...@enovatemedia.co.in>.
Try this pdf , it might help. IT seems to be you are trying complex configuration, the simple configuration would be example.com/jira
If you want simple configuration follow the attachment.
-----Original Message-----
From: Moritz Winter [mailto:moritz.a.winter@googlemail.com]
Sent: Tuesday, July 27, 2010 7:11 PM
To: users@tomcat.apache.org
Subject: mod_jk and tomcat virtual hosts not connecting
Hi, First of all I would like to mention that this is my first post on
this list, I hope that this question is sent in the right place.
I have tried finding a solution for my problem, but it either doesn't
exist, or my limited brain can't manage to figure out how to do it (I
strongly hope it is the latter).
My issue is with the mod_jk plugin. I want to redirect my subdomain
requests jira.example.com to a tomcat 6 virtual host called jiraapp. If
I call the subdomain jira.example.com Im always getting the default
tomcat 6 host called localhost.
I tested every part:
1.) mod_jk: if i change the workers name in either workers.properties or
und er my enabled-site <VirtualHost> or if i change the mapping to my
virtual host (/etc/hosts: 127.0.0.1 localhost jiraapp) apache doesnt
start. So I think this should work and is configured right.
2.) if I do a lynx jiraapp:8080 on the machine it works and shows the
right webapp.
But if I access jira.example.com I always getting the default
root-webapp of tomcat 6. So theres no difference in calling
jira.example.com or example.com:8080. In general my setup looks like this:
1.) browse to jira.example.com
2.) apache <VirtualHost> hands over to mod_jk
3.) mod_jk redirects to worker.jiraworker.host:worker.jiraworker.port
(jiraa pp:8009) via ajp
4.) jiraapp resolves to 127.0.0.1 trough /etc/hosts
5.) tomcat relays to the jiraapp name based virtual host
Do I miss something here? My guess would be that iam doing something
wrong in step 4 because i can call lynx jiraapp on the local bash (5)
and i can access the default virtual host from remote (1-3).
Help would be appreciated.
Versions:
Apache Tomcat/6.0.29
Sun-Java 1.6.0_20-b02
Apache/2.2.9 (Debian) mod_jk/1.2.26 proxy_html/3.0.0 Server
libapache2-mod-jk 1:1.2.26-2+lenny1
== jk.load ==
LoadModule jk_module /usr/lib/apache2/modules/mod_jk.so
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
JkLogLevel info
# JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
-ForwardLocalAddress
JkRequestLogFormat "%w %V %T"
== workers.properties ==
workers.tomcat_home=/opt/tomcat
workers.java_home=/usr/lib/jvm/java-6-sun
worker.list=jiraworker
worker.jiraworker.port=8009
worker.jiraworker.host=jiraapp
worker.jiraworker.type=ajp13
== /etc/hosts ==
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
127.0.0.1 localhost.localdomain localhost jiraapp
== server.xml ===
<Engine name="Catalina" defaultHost="localhost">
[...]
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
[...]
</Host>
<Host name="jiraapp" appBase="jiraapp" docBase="/opt/tomcat/jiraapp"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false" >
== apache example.com virtual hosts configuration file ==
<VirtualHost *:80>
ServerName www.jira.example.com
ServerAlias jira.example.com
JkMount /* jiraworker
</VirtualHost>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org