Re: Configuring mod_jk with multiple Apache HTTPD Virtual Hosts

2014-03-05 Thread Rainer Jung
On 04.03.2014 23:09, Doug Strick wrote:
 The F5 issues were just due to poor environment configuration.  Each F5 VIP
 was sending traffic to the same pool and that pool was only configured for
 1 member.  That 1 member IP/port was used by several apache virtual hosts.
  So basically I never knew which virtual host was getting the request which
 meant some requests were going to listeners not running mod_jk.  Always fun
 joining a new company and having to piece together what someone else has
 done.
 
 Please remember that over 90% of these configs were created by the Adobe CF
 webserver config utility so I question some of it as well.  Here is what's
 being used in the uriworkermap.properties:
 
 /cfformgateway/* = cfusion
 /CFFormGateway/* = cfusion
 /flex2gateway/* = cfusion
 /flex2gateway = cfusion
 /cffileservlet/* = cfusion
 /CFFileServlet/* = cfusion
 /cfform-internal/* = cfusion
 /flashservices/gateway/* = cfusion
 /flex-internal/* = cfusion
 /rest/* = cfusion
 /*.cfml/* = cfusion
 /*.mxml = cfusion
 /*.as = cfusion
 /*.cfm = cfusion
 /*.cfm/* = cfusion
 /*.swc = cfusion
 /*.cfml = cfusion
 /*.cfc = cfusion
 /*.cfc/* = cfusion
 /*.cfr = cfusion
 /*.cfswf = cfusion
 /*.sws = cfusion
 /*.jsp = cfusion
 /*.hbmxml = cfusion
 
 
 This is what I'm seeing in the mod_jk log.  I've cut out a few sections of
 the Attempting to map context URI so there's less clutter.
 
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI
 '/' from 24 maps
 
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 jk_translate::mod_jk.c (3723): no match for / found
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI
 '/' from 24 maps
 
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 jk_map_to_storage::mod_jk.c (3798): no match for / found
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI
 '/index.cfm' from 24 maps
 [
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 find_match::jk_uri_worker_map.c (958): Found a wildchar match
 '/*.cfm=cfusion'
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 jk_handler::mod_jk.c (2621): Into handler jakarta-servlet worker=cfusion
 r-proxyreq=0
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 wc_get_worker_for_name::jk_worker.c (115): found a worker cfusion
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 wc_get_name_for_type::jk_worker.c (292): Found worker type 'ajp13'
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 init_ws_service::mod_jk.c (1097): Service protocol=HTTP/0.9 method=GET
 ssl=false host=(null) addr=192.168.253.3 name=app1.dev5.abc.com port=80
 auth=(null) user=(null) laddr=192.168.253.61 raddr=192.168.253.3 uri=/
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_get_endpoint::jk_ajp_common.c (3161): acquired connection pool slot=0
 after 0 retries
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_marshal_into_msgb::jk_ajp_common.c (626): ajp marshaling done
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_service::jk_ajp_common.c (2450): processing cfusion with 2 retries
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): sending to ajp13
 pos=4 len=185 max=8192
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 12 34 00
 B5 02 02 00 08 48 54 54 50 2F 30 2E 39  - .4..HTTP/0.9
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 001000 00 01
 2F 00 00 0D 31 39 32 2E 31 36 38 2E 32  - .../...192.168.2
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 002035 33 2E
 33 00 FF FF 00 22 63 6F 6D 6D 65 72 63  - 53.3app1
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 003065 2E 64
 65 76 35 2E 6C 69 66 65 74 65 63 68 6E  - dev5.abc
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 00406F 6C 6F
 67 69 65 73 2E 63 6F 6D 00 00 50 00 00  - .com..P..
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 005002 A0 09
 00 27 54 4C 54 53 49 44 3D 31 38 36 35  - 'TLTSID=1865
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 006037 36 41
 32 41 33 45 35 31 30 41 33 30 30 30 33  - 76A2A3E510A30003
 [Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
 ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 007045 43 39
 33 42 35 31 31 39 39 42 43 00 A0 08 00  - 

Re: Configuring mod_jk with multiple Apache HTTPD Virtual Hosts

2014-03-04 Thread Doug Strick
I went over the documentation multiple times and the light bulb finally
went on after everyone's input.  Most of the mod_jk configs were built by
the Coldfusion web server config tool so that's why it's so cluttered.  I
made the configuration work by putting the below in httpd.conf:

IfModule mod_jk.c
JkWorkersFile /apps/httpd/conf.d/modjk/workers.properties
JkShmFile /weblogs/mod_jk.jk_shm
/IfModule

Then I stripped out everything from the virtual host config besides the
docroot and log configs like below which managed to start getting me
responses.  I also found there were major environment issues compounding my
experience because the F5 wasn't always sending traffic to this apache host
which is why I was banging my head most of the time trying to figure out
why I wasn't seeing anything in my logs.  Now that my apache config is good
I need to figure out why coldfusion is returning a 302 for GET /.


IfModule mod_jk.c
  JkMountFile /apps/httpd/conf.d/modjk/app1.uriworkermap.properties
  # Where to put jk logs
  JkLogFile /weblogs/mod_jk.app1.dev5.log
  # custom environment variables
  JkEnvVar REDIRECT_URL
  JkEnvVar REDIRECT_REMOTE_HOST
  JkEnvVar REDIRECT_PATH
  JkEnvVar REDIRECT_QUERY_STRING
  JkEnvVar REDIRECT_HTTP_ACCEPT
  JkEnvVar REDIRECT_HTTP_USER_AGENT
  JkEnvVar REDIRECT_REMOTE_ADDR
  JkEnvVar REDIRECT_SERVER_NAME
  JkEnvVar REDIRECT_SERVER_PORT
  JkEnvVar REDIRECT_SERVER_SOFTWARE
  # Where to put jk shared memory
  #JkShmFile /weblogs/app1.dev5.jk_shm
  # Set the jk log level [debug/error/info]
  JkLogLevel debug
  # Select the timestamp log format
  JkLogStampFormat [%a %b %d %H:%M:%S %Y] 
  JkOptions +ForwardDirectories
  AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf
  DirectoryIndex index.cfm
Files ~ .hbmxml$
  Order allow,deny
  Deny from all
/Files
/IfModule



On Mon, Mar 3, 2014 at 1:57 PM, André Warnier a...@ice-sa.com wrote:

 Doug Strick wrote:

 Hello,

 I'm currently working on a project where we're migrating from Adobe
 Coldfusion 8 to CF 10.  Adobe CF10 now uses tomcat as the underlying
 server
 and mod_jk is the standard connector used.  On our test environment we
 have
 a single apache httpd instance serving multiple domains with each going to
 a different CF instance.  We really only want specific workers enabled for
 specific virtual hosts like below.

 test1.abc.com -- HTTPD test1 VirtualHost -- CF Test1
 test2.abc.com -- HTTPD test2 VirtualHost -- CF Test2
 test3.abc.com -- HTTPD test3 VirtualHost -- CF Test3

 Each CF instance is on a separate host. A developer has managed to get a
 config working on their local desktop where CF10 runs under windows and
 apache runs under a linux VM.  The real dev environment is a lot more
 complicated with multiple virtual hosts.  CF is the only one where we're
 going to use mod_jk (CF 8 used mod_jrun22) so this is the first time using
 mod_jk in our environment.  Using the below config I keep getting
 JkWorkersFile cannot occur within VirtualHost section.  Does anyone
 have any suggestions as to what I need to do to make this work?


 See http://tomcat.apache.org/connectors-doc/reference/apache.html

 quote

 JkWorkersFile

 The name of a worker file for the Tomcat servlet containers.
 This directive is only allowed once. It must be put into the global part
 of the configuration.
 [...]

 unquote

 And the same for the JkShmFile directive.

 The global part of the configuration refers to the main (or default)
 Apache httpd configuration file (apache2.conf or httpd.conf e.g.),
 *outside* of any VirtualHost section.

 The JkWorkersFile file defines *all* the workers (in mod_jk parlance,
 a worker is usually one back-end Tomcat instance). So in your case, you
 would have 3 workers (Test1, Test2 and Test3).

 Then inside of each VirtualHost section, you would use JkMount
 directives, to indicate *for this VirtualHost* which URI's should be
 proxied to which of the known workers.
 For example,
 in VirtualHost #1
JkMount /myapp/ Test1
JkMount /myapp/* Test1

 in VirtualHost #2
JkMount /myapp/ Test2
JkMount /myapp/* Test2

 in VirtualHost #3
JkMount /myapp/ Test3
JkMount /myapp/* Test3


 Also, it does not really make much sense to have both JkMount directives
 directly in your configuration, *and* a JkMountFile directive. Usually,
 one uses the one or the other. It is less confusing, because both specify
 lists of URI's which should be/should not be proxied to Tomcat.

 Another configuration directive which should only be there once, and in
 the main httpd configuration section (not in VirtualHost) is
  LoadModule jk_module  /apps/httpd/modules/mod_jk.so
 It is probably ignored when it occurs in a VirtualHost section.
 See 

Re: Configuring mod_jk with multiple Apache HTTPD Virtual Hosts

2014-03-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Doug,

On 3/4/14, 11:51 AM, Doug Strick wrote:
 I went over the documentation multiple times and the light bulb
 finally went on after everyone's input.  Most of the mod_jk configs
 were built by the Coldfusion web server config tool so that's why
 it's so cluttered.  I made the configuration work by putting the
 below in httpd.conf:
 
 IfModule mod_jk.c JkWorkersFile
 /apps/httpd/conf.d/modjk/workers.properties JkShmFile
 /weblogs/mod_jk.jk_shm /IfModule
 
 Then I stripped out everything from the virtual host config besides
 the docroot and log configs like below which managed to start
 getting me responses.

Good.

 I also found there were major environment issues compounding my 
 experience because the F5 wasn't always sending traffic to this
 apache host which is why I was banging my head most of the time
 trying to figure out why I wasn't seeing anything in my logs.

Sounds fun. Anything that might be useful to folks searching the list
archives for help?

 Now that my apache config is good I need to figure out why
 coldfusion is returning a 302 for GET /.

GET / probably returns a 302 for /index.cfm, since you set the
DirectoryIndex to be index.cfm. What does the whole response look like?

 IfModule mod_jk.c JkMountFile
 /apps/httpd/conf.d/modjk/app1.uriworkermap.properties

The contents of this file might be useful, too.

 # Where to put jk logs JkLogFile /weblogs/mod_jk.app1.dev5.log #
 custom environment variables JkEnvVar REDIRECT_URL JkEnvVar
 REDIRECT_REMOTE_HOST JkEnvVar REDIRECT_PATH JkEnvVar
 REDIRECT_QUERY_STRING JkEnvVar REDIRECT_HTTP_ACCEPT JkEnvVar
 REDIRECT_HTTP_USER_AGENT JkEnvVar REDIRECT_REMOTE_ADDR JkEnvVar
 REDIRECT_SERVER_NAME JkEnvVar REDIRECT_SERVER_PORT JkEnvVar
 REDIRECT_SERVER_SOFTWARE

I'm not entirely sure you need all these JkEnvVar directives, but I
wouldn't remove them unless you are sure they are useless.

 # Where to put jk shared memory #JkShmFile
 /weblogs/app1.dev5.jk_shm # Set the jk log level
 [debug/error/info] JkLogLevel debug # Select the timestamp log
 format JkLogStampFormat [%a %b %d %H:%M:%S %Y]  JkOptions
 +ForwardDirectories

Are you sure you want to do that?

 AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf

It's still odd to me that you are using an explicit map but then also
doing the AddHandler.

 DirectoryIndex index.cfm Files ~ .hbmxml$ Order allow,deny Deny
 from all /Files /IfModule

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTFiO2AAoJEBzwKT+lPKRYZ+cP/jQJNPR+fHixhbUy7Ct/2mkf
/pnqzOJ/+AUb0mu2N+7+c7sl3+hSd3+p7bi2GIEOMVa3jzXNvWctONPwsn2+A8/d
nijlO38E34AOj3RuDcIOYrAdz94TPncFkwQOT2Z4TOR1YRQrZe0rVJwRAD5To/xU
M+aYzeXJhTrSXLyZ9vurDkt7JYOO4rEKvQyTN0qbqfbNHuhrpruZDj2WPyuTr4xG
0Y08TmPW+e4Hp/M6zFsgo5LY3PZpNXtkNq6g34OINqGfF64FPO9Y6Ps5IVeozP6G
iWmFEtwD5HrZEmgbICZeaOwy+UjhzrpiUF7krSLp2igKlEcGiuMzSJlmY+MEvQ8f
JocGehFrY/VYdIYIdQKvkJtervlWUGTjFXZbeQSZgdArhCn7qpFHzI64nzR5y4KC
jyjOVCZ36+5LT1+41yNVnq1lTrUUHZ6ODGxJ5+AMaFPXgoOu/H2w1+4hx4f8Q4Bn
1eI8wpJ8IvLYyvaJ+Qmu5Sr+qhgPaFpru+Y38Eu2uH1cgKVz6Cya92sbXRY5yZ3U
ChGGhedSFLpt99raUc8Tk9c1+NbNPzTrs9MKn2QBnRkCZTNKaHp71xc9TA1oFvGg
YfEgBiazCBMxiEs864V4IcwWeqxqH0rS9vr62E5p6xkt7JSW7KvP55eT3m+bUEHa
jOdWslaH0H/syNMdfhsy
=mR2i
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Configuring mod_jk with multiple Apache HTTPD Virtual Hosts

2014-03-04 Thread Doug Strick
The F5 issues were just due to poor environment configuration.  Each F5 VIP
was sending traffic to the same pool and that pool was only configured for
1 member.  That 1 member IP/port was used by several apache virtual hosts.
 So basically I never knew which virtual host was getting the request which
meant some requests were going to listeners not running mod_jk.  Always fun
joining a new company and having to piece together what someone else has
done.

Please remember that over 90% of these configs were created by the Adobe CF
webserver config utility so I question some of it as well.  Here is what's
being used in the uriworkermap.properties:

/cfformgateway/* = cfusion
/CFFormGateway/* = cfusion
/flex2gateway/* = cfusion
/flex2gateway = cfusion
/cffileservlet/* = cfusion
/CFFileServlet/* = cfusion
/cfform-internal/* = cfusion
/flashservices/gateway/* = cfusion
/flex-internal/* = cfusion
/rest/* = cfusion
/*.cfml/* = cfusion
/*.mxml = cfusion
/*.as = cfusion
/*.cfm = cfusion
/*.cfm/* = cfusion
/*.swc = cfusion
/*.cfml = cfusion
/*.cfc = cfusion
/*.cfc/* = cfusion
/*.cfr = cfusion
/*.cfswf = cfusion
/*.sws = cfusion
/*.jsp = cfusion
/*.hbmxml = cfusion


This is what I'm seeing in the mod_jk log.  I've cut out a few sections of
the Attempting to map context URI so there's less clutter.

[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI
'/' from 24 maps

[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
jk_translate::mod_jk.c (3723): no match for / found
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI
'/' from 24 maps

[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
jk_map_to_storage::mod_jk.c (3798): no match for / found
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI
'/index.cfm' from 24 maps
[
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
find_match::jk_uri_worker_map.c (958): Found a wildchar match
'/*.cfm=cfusion'
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
jk_handler::mod_jk.c (2621): Into handler jakarta-servlet worker=cfusion
r-proxyreq=0
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
wc_get_worker_for_name::jk_worker.c (115): found a worker cfusion
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
wc_get_name_for_type::jk_worker.c (292): Found worker type 'ajp13'
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
init_ws_service::mod_jk.c (1097): Service protocol=HTTP/0.9 method=GET
ssl=false host=(null) addr=192.168.253.3 name=app1.dev5.abc.com port=80
auth=(null) user=(null) laddr=192.168.253.61 raddr=192.168.253.3 uri=/
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_get_endpoint::jk_ajp_common.c (3161): acquired connection pool slot=0
after 0 retries
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_marshal_into_msgb::jk_ajp_common.c (626): ajp marshaling done
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_service::jk_ajp_common.c (2450): processing cfusion with 2 retries
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): sending to ajp13
pos=4 len=185 max=8192
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 12 34 00
B5 02 02 00 08 48 54 54 50 2F 30 2E 39  - .4..HTTP/0.9
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 001000 00 01
2F 00 00 0D 31 39 32 2E 31 36 38 2E 32  - .../...192.168.2
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 002035 33 2E
33 00 FF FF 00 22 63 6F 6D 6D 65 72 63  - 53.3app1
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 003065 2E 64
65 76 35 2E 6C 69 66 65 74 65 63 68 6E  - dev5.abc
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 00406F 6C 6F
67 69 65 73 2E 63 6F 6D 00 00 50 00 00  - .com..P..
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 005002 A0 09
00 27 54 4C 54 53 49 44 3D 31 38 36 35  - 'TLTSID=1865
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 006037 36 41
32 41 33 45 35 31 30 41 33 30 30 30 33  - 76A2A3E510A30003
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 007045 43 39
33 42 35 31 31 39 39 42 43 00 A0 08 00  - EC93B51199BC
[Tue Mar 04 16:36:50 2014] [5763:140265396258560] [debug]
ajp_connection_tcp_send_message::jk_ajp_common.c (1184): 008001 30 00
0A 00 0F 

Re: Configuring mod_jk with multiple Apache HTTPD Virtual Hosts

2014-03-03 Thread André Warnier

Doug Strick wrote:

Hello,

I'm currently working on a project where we're migrating from Adobe
Coldfusion 8 to CF 10.  Adobe CF10 now uses tomcat as the underlying server
and mod_jk is the standard connector used.  On our test environment we have
a single apache httpd instance serving multiple domains with each going to
a different CF instance.  We really only want specific workers enabled for
specific virtual hosts like below.

test1.abc.com -- HTTPD test1 VirtualHost -- CF Test1
test2.abc.com -- HTTPD test2 VirtualHost -- CF Test2
test3.abc.com -- HTTPD test3 VirtualHost -- CF Test3

Each CF instance is on a separate host. A developer has managed to get a
config working on their local desktop where CF10 runs under windows and
apache runs under a linux VM.  The real dev environment is a lot more
complicated with multiple virtual hosts.  CF is the only one where we're
going to use mod_jk (CF 8 used mod_jrun22) so this is the first time using
mod_jk in our environment.  Using the below config I keep getting
JkWorkersFile cannot occur within VirtualHost section.  Does anyone
have any suggestions as to what I need to do to make this work?  


See http://tomcat.apache.org/connectors-doc/reference/apache.html

quote

JkWorkersFile   

The name of a worker file for the Tomcat servlet containers.
This directive is only allowed once. It must be put into the global part of the 
configuration.
[...]

unquote

And the same for the JkShmFile directive.

The global part of the configuration refers to the main (or default) Apache httpd 
configuration file (apache2.conf or httpd.conf e.g.), *outside* of any VirtualHost section.


The JkWorkersFile file defines *all* the workers (in mod_jk parlance, a worker is 
usually one back-end Tomcat instance). So in your case, you would have 3 workers (Test1, 
Test2 and Test3).


Then inside of each VirtualHost section, you would use JkMount directives, to indicate 
*for this VirtualHost* which URI's should be proxied to which of the known workers.

For example,
in VirtualHost #1
   JkMount /myapp/ Test1
   JkMount /myapp/* Test1

in VirtualHost #2
   JkMount /myapp/ Test2
   JkMount /myapp/* Test2

in VirtualHost #3
   JkMount /myapp/ Test3
   JkMount /myapp/* Test3


Also, it does not really make much sense to have both JkMount directives directly in 
your configuration, *and* a JkMountFile directive. Usually, one uses the one or the 
other. It is less confusing, because both specify lists of URI's which should be/should 
not be proxied to Tomcat.


Another configuration directive which should only be there once, and in the main httpd 
configuration section (not in VirtualHost) is

 LoadModule jk_module  /apps/httpd/modules/mod_jk.so
It is probably ignored when it occurs in a VirtualHost section.
See http://httpd.apache.org/docs/2.2/mod/mod_so.html#loadmodule

There are some other things which I find a bit strange (or unclear or redundant) in the 
configuration below, such as  the conjunction of :


DirectoryIndex index.cfm index.html index.html.var
...
  JkMount / cfusion
  JkMount /* cfusion
...
  AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf
  DirectoryIndex index.cfm

All in all, it looks a bit like an accumulation of miscellaneous overlapping and 
contradictory instructions, put together by chance more than by a good understanding of 
what each one really achieves and in what order they are evaluated.

For example :

  JkMount / cfusion
  JkMount /* cfusion
These directives will result in Apache httpd, in effect, proxying *all* requests to the 
Tomcat worker named cfusion, leaving none to be handled by Apache httpd itself.

But then, these directives :
DirectoryIndex index.cfm index.html index.html.var
  AddHandler jakarta-servlet .cfm .cfml .cfc .cfr .cfswf
  DirectoryIndex index.cfm

are totaly redundant, even among themselves.

This is

currently apache 2.2.26 compiled from source and mod_jk 1.2.37 compiled
from source as well.


VirtualHost Example
VirtualHost 192.168.253.61:80 http://192.168.253.61/
   DocumentRoot /web/app1.dev5.abc.com/scms
   ServerName app1.dev5.abc.com
   ServerAlias origin-app1.dev5.abc.com
   alias /shared-static /web/app1.dev5.abc.com/shared-static
   ErrorLog |/apps/httpd/bin/rotatelogs
/weblogs/app1.dev5.abc-error.%Y%m%d 86400 -480
   CustomLog |/apps/httpd/bin/rotatelogs
/weblogs/app1.dev5.abc-access.%Y%m%d 86400 -480 combined env=!keepaliveuri
   DirectoryIndex index.cfm index.html index.html.var
  #AddDefaultCharset UTF-8

LoadModule jk_module  /apps/httpd/modules/mod_jk.so

IfModule mod_jk.c
 JkMount / cfusion
 JkMount /* cfusion
# Where to find workers.properties
 JkWorkersFile /apps/httpd/conf.d/modjk/app1.dev5.workers.properties
 JkMountFile
/apps/httpd/conf.d/modjk/app1.dev5.uriworkermap.properties
# Where to put jk logs
   

Re: Configuring mod_jk with multiple Apache HTTPD Virtual Hosts

2014-03-03 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

André,

On 3/3/14, 4:57 PM, André Warnier wrote:
 Doug Strick wrote:
 Hello,
 
 I'm currently working on a project where we're migrating from
 Adobe Coldfusion 8 to CF 10.  Adobe CF10 now uses tomcat as the
 underlying server and mod_jk is the standard connector used.  On
 our test environment we have a single apache httpd instance
 serving multiple domains with each going to a different CF
 instance.  We really only want specific workers enabled for 
 specific virtual hosts like below.
 
 test1.abc.com -- HTTPD test1 VirtualHost -- CF Test1 
 test2.abc.com -- HTTPD test2 VirtualHost -- CF Test2 
 test3.abc.com -- HTTPD test3 VirtualHost -- CF Test3
 
 Each CF instance is on a separate host. A developer has managed
 to get a config working on their local desktop where CF10 runs
 under windows and apache runs under a linux VM.  The real dev
 environment is a lot more complicated with multiple virtual
 hosts.  CF is the only one where we're going to use mod_jk (CF 8
 used mod_jrun22) so this is the first time using mod_jk in our
 environment.  Using the below config I keep getting 
 JkWorkersFile cannot occur within VirtualHost section.  Does
 anyone have any suggestions as to what I need to do to make this
 work?
 
 See http://tomcat.apache.org/connectors-doc/reference/apache.html
 
 quote
 
 JkWorkersFile
 
 The name of a worker file for the Tomcat servlet containers. This
 directive is only allowed once. It must be put into the global
 part of the configuration. [...]
 
 unquote
 
 And the same for the JkShmFile directive.
 
 The global part of the configuration refers to the main (or
 default) Apache httpd configuration file (apache2.conf or
 httpd.conf e.g.), *outside* of any VirtualHost section.
 
 The JkWorkersFile file defines *all* the workers (in mod_jk 
 parlance, a worker is usually one back-end Tomcat instance). So
 in your case, you would have 3 workers (Test1, Test2 and Test3).
 
 Then inside of each VirtualHost section, you would use JkMount 
 directives, to indicate *for this VirtualHost* which URI's should
 be proxied to which of the known workers. For example, in
 VirtualHost #1 JkMount /myapp/ Test1 JkMount /myapp/* Test1
 
 in VirtualHost #2 JkMount /myapp/ Test2 JkMount /myapp/* Test2
 
 in VirtualHost #3 JkMount /myapp/ Test3 JkMount /myapp/* Test3
 
 
 Also, it does not really make much sense to have both JkMount 
 directives directly in your configuration, *and* a JkMountFile 
 directive. Usually, one uses the one or the other. It is less
 confusing, because both specify lists of URI's which should
 be/should not be proxied to Tomcat.

+1

It's bad enough that mod_jk has to have a separate configuration file
(it's one of the only significant improvements mod_proxy_ajp has over
mod_jk), but separating your configuration into 2 different files is
going to confuse you in the long run.

Along with this, I note that you are mapping / and /* to your
mod_jk worker, and then also using AddHandler as well. I suspect you
could probably remove all of your JkMount, JkMountFile, and AddHandler
directives and replace them all with these:

  JkMount /*.cfm   cfusion
  JkMount /*.cfml  cfusion
  JkMount /*.cfc   cfusion
  JkMount /*.cfr   cfusion
  JkMount /*.cfswf cfusion

This will *only* send requests for the above URL extensions to Tomcat,
and everything else (static content, etc.) will be handled by httpd.
You should probably set a DocumentRoot for this VirtualHost.

I'm not sure if you ever had a problem with the one frontend - one
backend configuration because you don't appear to have gotten that
far. It's trivial to configure httpd to do that: just use different
worker names for each back-end and then in httpd.conf, simply use one
of them. If you ever want to load-balance, just create a
balancing-worker that balances between the workers you're already
defined and then use /that/ in httpd.conf.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJTFQAqAAoJEBzwKT+lPKRY4FMP/Axum0yT0E4g3tTuXkT+saHf
jOF6/mwAjC60+WZONTJJRS7B2yli+rr50m1oRKuT0MjrBcnaHLjUH4sX0DhipVis
6G4+cYFNxcxPQR9T/qNXASKXb3g0LP+QzZ2Z6tuI7ouvfgG+2qM2tudLuzF82l3i
4ZrxYsD1wSyfLiz+HHpjiaNxmUuLe7CuDlWR1WBSaSet8Ekm1THaNpV7SulJIlOb
7hezzn9W+4DCmNONlMKkGywVTN3xQ0nr7erbDwoz/Q2MytpozN1duXeGC/CoZrQU
3/2FFtA3GxYzCz953p+7+KVnXYU0yrW7raMC7261x3XuHvn2QTQ1DU3BPqEIQWY3
fYvEXdq2tdu9BCrd0NtEd6pTJC9A4u2QqJUW2wgbdjTs+hlyFFS8kCwyWiwJhpbu
xcfPEH91rj8pgq6u2lBM4QRtZWNo7fGYhs+EAMrsVoO0bHY8iXige2f6WlbmDHAC
x/EW3O8Cpb3XFPofKG9VgFWtL/m8/OXKX4oy4AEpiyS/Sv0TkTiz6NXuIfYG6C9Q
e1w1jMNET/CcJKCMtgL7mmS8skA0NXsXug9mLCu5tp1wK/3son9eJ5Eyc0QaoTTK
eLO5MeNX5WZiEXGebTmy/wTsd9RXUJtzpqj1bzaye+1vjjd63f904u2vMDOom5ZR
h2/oNGT7l3lph86+3giS
=KRdb
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For