You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Nicola Burns <ni...@firecrestclinical.com> on 2008/10/08 14:52:08 UTC

apache virtual hosts using different tomcat on different servers

Hi,

 

Is it possible to have the following scenario configured?

 

Virtual host 

 

test1.foo.com using apache on server1 

configured in workers.properties file as  workerA that points to
localhost jboss

 

And

 

test2.foo.com also using apache on server1 

configured in the workers.properties file as  workerB that points to
server2 for jboss

 

test1.foo.com works. Test2.foo.com goes to the same application because
they are both reading from the localhost mod-jk.conf.

Is there an additional parameter I need in the with in the VirtualHost
tag in httpd-vhosts.conf to get test2.foo.com to go to the remote jboss?

 

Thank you,

Nic


Re: apache virtual hosts using different tomcat on different servers

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
Nicola Burns wrote:
> test1.foo.com works. Test2.foo.com goes to the same application because
> they are both reading from the localhost mod-jk.conf.
>   
Try to use apache 2.x with mod_proxy_ajp - there's no mod-jk.conf file, 
you configure connections to ajp connectors inside VirtualHost elements 
instead.

-- 
Mikolaj Rydzewski <mi...@ceti.pl>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: apache virtual hosts using different tomcat on different servers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicola,

Nicola Burns wrote:
> To further explain my testing with virtual hosts test1.foo.com using
> localhost jboss and test2.foo.com uses server2 jboss. If I test
> placing my jkmount statements for either jboss into the virtual hosts
> tag, I get the server not found error I also removed the include
> statement from http.conf that points to my mod_jk.conf

If mod_jk.conf isn't being loaded, then the module isn't being loaded.
I'm not sure if your Apache httpd installation auto-includes files, but
if the 'LoadModule' directive isn't being read, then mod_jk isn't being
loaded.

Can you change your JkLogLevel to debug and make sure that it's actually
being started? You can also see what the mod_jk log contains after you
request a page you think should go to Tomcat.

Also, please give an example URL that you are trying when you get the 404.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj0+mYACgkQ9CaO5/Lv0PACwwCfaEbpqSxPYi+SJuts60wonOVU
t6cAnAiSs6Xf50VAVKIG2WvBwP134+FA
=tCnx
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: apache virtual hosts using different tomcat on different servers

Posted by Nicola Burns <ni...@firecrestclinical.com>.
To further explain my testing with virtual hosts test1.foo.com using localhost jboss and test2.foo.com uses server2 jboss.
If I test placing my jkmount statements for either jboss into the virtual hosts tag, I get the server not found error
I also removed the include statement from http.conf that points to my mod_jk.conf 

Thanks,
Nicola

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: 13 October 2008 15:43
To: Tomcat Users List
Subject: Re: apache virtual hosts using different tomcat on different servers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicola,

Nicola Burns wrote:
> I move my 'JkMount *.jsp workerA' information from mod_jk.conf into
> my virtual hosts tag and restart apache. When I attempt to access my
> url test1.foo.com, apache tell me it cannot find my home.do page to
> login (not found in this server, but when I simply move this back to
> the mod_jk.conf file again, I can login?

Can you post your mod_jk configuration? Please post both mod_jk.conf
/and/ the JkMount directives you are using (and indicate which virtual
hosts they are in).

> The only thing I leave in the mod_jk.conf file is the location of the
> log/worker.properties files. Is this a windows relative path issue?

It's possible, but not likely. Provide a complete path if you are
concerned about it. Also, you could look at your log file to see if
there are any mod_jk startup errors.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjzXowACgkQ9CaO5/Lv0PCGqACfYZWToZE+/bx5yDJHXCs4jkg0
E+UAoI9tk2mE7ELg2UBVnPszSFM7MNM6
=wWdS
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: apache virtual hosts using different tomcat on different servers

Posted by Nicola Burns <ni...@firecrestclinical.com>.
Hi Chris,

My mod_jk.conf setting are below, no error reported in the mod_jk.log file when I have the following in either virtual hosts tag or in mod_jk.conf. I am only testing with test1.foo.com, apache is running on the localhost and my jboss app is on a remote server, worker82

Nicola 

LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/ctp/workers.properties

# Where to put jk logs
JkLogFile     d:/tools/apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel    info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# Option to mount and point apache to jboss on 212.147.152.81 (this is a remote server where my jboss app is running)
# JkOptions indicate to send SSL KEY SIZE,
JkOptions     +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
JkRequestLogFormat     "%w %V %T"
JkShmFile logs/jk.shm

<Location /jkstatus/>
    JkMount status
      Order deny,allow
      Deny from all
      Allow from 127.0.0.1
</Location>

# Mount my app for test1.foo.com on worker82
JkMount /ctp/* worker82
JkMount /vengine/* worker82
JkUnMount /ctp/images/* worker82
JkUnMount /ctp/editor/* worker82
JkUnMount /ctp/css/* worker82
JkMount /cerplay/* worker82
JkMount /coplay/* worker82
JkMount /login/j_security_check worker82
JkMount /webservices/webservice worker82

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: 13 October 2008 15:43
To: Tomcat Users List
Subject: Re: apache virtual hosts using different tomcat on different servers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicola,

Nicola Burns wrote:
> I move my 'JkMount *.jsp workerA' information from mod_jk.conf into
> my virtual hosts tag and restart apache. When I attempt to access my
> url test1.foo.com, apache tell me it cannot find my home.do page to
> login (not found in this server, but when I simply move this back to
> the mod_jk.conf file again, I can login?

Can you post your mod_jk configuration? Please post both mod_jk.conf
/and/ the JkMount directives you are using (and indicate which virtual
hosts they are in).

> The only thing I leave in the mod_jk.conf file is the location of the
> log/worker.properties files. Is this a windows relative path issue?

It's possible, but not likely. Provide a complete path if you are
concerned about it. Also, you could look at your log file to see if
there are any mod_jk startup errors.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjzXowACgkQ9CaO5/Lv0PCGqACfYZWToZE+/bx5yDJHXCs4jkg0
E+UAoI9tk2mE7ELg2UBVnPszSFM7MNM6
=wWdS
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: apache virtual hosts using different tomcat on different servers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicola,

Nicola Burns wrote:
> I move my 'JkMount *.jsp workerA' information from mod_jk.conf into
> my virtual hosts tag and restart apache. When I attempt to access my
> url test1.foo.com, apache tell me it cannot find my home.do page to
> login (not found in this server, but when I simply move this back to
> the mod_jk.conf file again, I can login?

Can you post your mod_jk configuration? Please post both mod_jk.conf
/and/ the JkMount directives you are using (and indicate which virtual
hosts they are in).

> The only thing I leave in the mod_jk.conf file is the location of the
> log/worker.properties files. Is this a windows relative path issue?

It's possible, but not likely. Provide a complete path if you are
concerned about it. Also, you could look at your log file to see if
there are any mod_jk startup errors.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjzXowACgkQ9CaO5/Lv0PCGqACfYZWToZE+/bx5yDJHXCs4jkg0
E+UAoI9tk2mE7ELg2UBVnPszSFM7MNM6
=wWdS
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: apache virtual hosts using different tomcat on different servers

Posted by Nicola Burns <ni...@firecrestclinical.com>.
Thanks Christopher & Mikolaj for your very helpful information.

I move my 'JkMount *.jsp workerA' information from mod_jk.conf into my virtual hosts tag and restart apache.
When I attempt to access my url test1.foo.com, apache tell me it cannot find my home.do page to login (not found in this server, but when I simply move this back to the mod_jk.conf file again, I can login? 

The only thing I leave in the mod_jk.conf file is the location of the log/worker.properties files. Is this a windows relative path issue?


Thanks,
Nicola

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: 10 October 2008 20:36
To: Tomcat Users List
Subject: Re: apache virtual hosts using different tomcat on different servers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicola,

Nicola Burns wrote:
> Is it possible to have the following scenario configured?

Executive summary: different back-end Tomcat servers for different
VistualHosts.

The answer is "of course you can"!

It sounds like you want this:

VirtualHost test1.foo.com
workerA -> localhost:jboss

VirtualHost test2.foo.com
workerB -> server2:jboss

> test1.foo.com works. Test2.foo.com goes to the same application because
> they are both reading from the localhost mod-jk.conf.

mod-jk.conf isn't something standard, so whatever you have has been
home-built. I suspect that you have all your mod_jk configuration in
there, including JkMount statements, and that you are including it at
the top-level.

You have to separate your JkMount statements into your VirtualHosts.

For example, I have a global mod_jk.conf file and it looks like this:

LoadModule jk_module /usr/lib/apache2/modules/mod_jk-1.2.26.so
JkLogFile /var/log/apache2/mod_jk.log
JkWorkersFile /usr/lib/apache2/modules/jk_workers.properties
JkShmFile /var/log/apache2/jk-runtime-status


That's it! Everything else goes into the appropriate VirtualHost along
with the rest of the config for that VH.

Note that the workers configuration is shared. That means that
workers.properties must contain the configuration for all workers across
all virtual hosts. Maybe something like this:

workers.list=workerA,workerB

workerA.host=localhost
workerA.port=[your jboss port]

workerB.host=server2
workerB.port=[your jboss port]

Then, you need something in each VirtualHost that looks like this (your
configuration may vary wildly, but this should get you started):

<VirtualHost test1.foo.com>
   ... other VH configuration ...
   JkMount *.jsp workerA
</VirtualHost>

<VirtualHost test2.foo.com>
   ... other VH configuration ...
   JkMount *.jsp workerB
</VirtualHost>

With regard to Mikolaj's comments, mod_jk just has a different style of
defining endpoints than mod_proxy_ajp. Technically, mod_jk does not
require workers.properties, nor does it require mod-jk.conf.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvrogACgkQ9CaO5/Lv0PDRsgCfSTIG1xxGriYilkyXNwrY+6c7
qEoAoJWNFsiOpSFttrqRKdZ6OPDGwY51
=wBnJ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: apache virtual hosts using different tomcat on different servers

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nicola,

Nicola Burns wrote:
> Is it possible to have the following scenario configured?

Executive summary: different back-end Tomcat servers for different
VistualHosts.

The answer is "of course you can"!

It sounds like you want this:

VirtualHost test1.foo.com
workerA -> localhost:jboss

VirtualHost test2.foo.com
workerB -> server2:jboss

> test1.foo.com works. Test2.foo.com goes to the same application because
> they are both reading from the localhost mod-jk.conf.

mod-jk.conf isn't something standard, so whatever you have has been
home-built. I suspect that you have all your mod_jk configuration in
there, including JkMount statements, and that you are including it at
the top-level.

You have to separate your JkMount statements into your VirtualHosts.

For example, I have a global mod_jk.conf file and it looks like this:

LoadModule jk_module /usr/lib/apache2/modules/mod_jk-1.2.26.so
JkLogFile /var/log/apache2/mod_jk.log
JkWorkersFile /usr/lib/apache2/modules/jk_workers.properties
JkShmFile /var/log/apache2/jk-runtime-status


That's it! Everything else goes into the appropriate VirtualHost along
with the rest of the config for that VH.

Note that the workers configuration is shared. That means that
workers.properties must contain the configuration for all workers across
all virtual hosts. Maybe something like this:

workers.list=workerA,workerB

workerA.host=localhost
workerA.port=[your jboss port]

workerB.host=server2
workerB.port=[your jboss port]

Then, you need something in each VirtualHost that looks like this (your
configuration may vary wildly, but this should get you started):

<VirtualHost test1.foo.com>
   ... other VH configuration ...
   JkMount *.jsp workerA
</VirtualHost>

<VirtualHost test2.foo.com>
   ... other VH configuration ...
   JkMount *.jsp workerB
</VirtualHost>

With regard to Mikolaj's comments, mod_jk just has a different style of
defining endpoints than mod_proxy_ajp. Technically, mod_jk does not
require workers.properties, nor does it require mod-jk.conf.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkjvrogACgkQ9CaO5/Lv0PDRsgCfSTIG1xxGriYilkyXNwrY+6c7
qEoAoJWNFsiOpSFttrqRKdZ6OPDGwY51
=wBnJ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org