Maybe it is just a question of perspective.

An Apache httpd VirtualHost is not a separate entity, like a child process or a 
thread.
It is just a "personality" which any Apache child temporarily takes, during the processing of one single request. At the next request processed by this same Apache child/thread, it may take the personality of another VirtualHost. It just changes its configuration.

When you consider things from that perspective, then you easily understand why some configuration directives have "server scope" (fixed when the server boots, and server-wide in scope), and other have "VirtualHost scope". The ones that can just be switched by using another set of configuration directives (to process the current request) are OK for a VirtualHost. But the ones that load a module in memory for example, are not OK at VirtualHost level, because loading/unloading modules for each request would be very expensive.

So for example a JkMount has VirtualHost scope, because it is easy for the child to switch to another set of URL mappings for this request. But JkShmFile has server-wide scope (and cannot be used in a VirtualHost), because it would make no sense to have a separate shared memory setting per VirtualHost (since a VirtualHost is not really a process anyway, and since this is a setting which must allow several Apache /children/ processes to share some information).


Igor Cicimov wrote:
My bad, if I put only

<IfModule jk_module>
    JkMount /jkmanager/* jkstatus
</IfModule>

in the VirtualHost it works but it doesn't allow any other jk setting to be
put inside. So I have the rest of the mod_jk settings in the httpd.conf
making them globally available.

Still wonder why would only jkmanager behave this way?

Igor

On Fri, Mar 25, 2011 at 12:27 PM, Igor Cicimov <icici...@gmail.com> wrote:

Hi all,

I have tomcat 6.0.26 running on Soalaris 10 and Apache 2.2.15 in front of
it with mod_jk 1.2.31 on the same host. I can't get the jkmanager page back
from mod_jk and this is my relevant configuration:


1) /usr/local/apache2/conf/httpd.conf

<IfModule jk_module>
   JkWorkersFile   conf/workers.properties
   JkLogFile "|/usr/local/apache2/bin/rotatelogs
/usr/local/apache2/logs/mod_jk.log.%Y%m%d 86400"
   JkLogLevel Debug
   JKShmSize 256
   JkShmFile logs/jk.shm
   JkMount /sample1/* worker1
   JkMount /sample2/* worker1
   JkMount /jkmanager/* jkstatus
   JkMountCopy All
</IfModule>
Include conf/extra/httpd-vhosts.conf

2) /usr/local/apache2/conf/workers.properties

worker.list=jkstatus,worker1

worker.basic.port=8009
worker.basic.type=ajp13
worker.basic.socket_keepalive=true
worker.basic.connect_timeout=120
worker.basic.recovery_options=7

worker.worker1.host=localhost
worker.worker1.reference=worker.basic

worker.jkstatus.type=status

3) /usr/local/apache2/conf/extras/httpd-vhosts.conf

NameVirtualHost x.x.x.x:8880
<VirtualHost x.x.x.x:8880>

</VirtualHost>

(the only VH I have configured so it's default one)


Accessing http://x.x.x.x:8880/sample1 and http://x.x.x.x:8880/sample2works fine 
but
http://x.x.x.x:8880/jkmanager returns 404 form the Tomcat server and NOT
from Apache so somehow the requests are being forwarded instead handled by
the Apache module.

Of course my first guess was that the "JkMount /jkmanager/* jkstatus" is
somehow not being inherited by the VirtualHost but putting the mod_jk
settings inside the host produces errors of type "Can't have JkMount inside
Virtual Host". Putting only "JkMount /jkmanager/* jkstatus" statement inside
VH also didn't work.

I can see the following debug:

[Fri Mar 25 11:41:27.196 2011] [25218:1] [debug]
build_worker_map::jk_worker.c (242): creating worker jkstatus
[Fri Mar 25 11:41:27.196 2011] [25218:1] [debug]
wc_create_worker::jk_worker.c (146): about to create instance jkstatus of st
atus
[Fri Mar 25 11:41:27.197 2011] [25218:1] [debug]
wc_create_worker::jk_worker.c (159): about to validate and init jkstatus
[Fri Mar 25 11:41:27.197 2011] [25218:1] [debug] init::jk_status.c (5053):
Status worker 'jkstatus' is read/write and has css
 '(null)', prefix 'worker', name space 'jk:', xml name space 'xmlns:jk="
http://tomcat.apache.org";', document type '(null)'
[Fri Mar 25 11:41:27.197 2011] [25218:1] [debug] init::jk_status.c (5104):
Status worker 'jkstatus' has good rating for '0000
000f' and bad rating for '00ff1010'

[Fri Mar 25 11:41:27.198 2011] [25218:1] [debug]
uri_worker_map_dump::jk_uri_worker_map.c (186): NEXT (1) map #0: uri=/jkmana
ger/* worker=jkstatus context=/jkmanager/* source=JkMount type=Wildchar
len=12

[Fri Mar 25 11:41:27.198 2011] [25218:1] [info] init_jk::mod_jk.c (3189):
mod_jk/1.2.30 initialized
[Fri Mar 25 11:41:27.198 2011] [25218:1] [debug]
wc_get_worker_for_name::jk_worker.c (116): found a worker jkstatus
[Fri Mar 25 11:41:27.198 2011] [25218:1] [debug]
wc_get_name_for_type::jk_worker.c (293): Found worker type 'status'
[Fri Mar 25 11:41:27.198 2011] [25218:1] [debug]
uri_worker_map_ext::jk_uri_worker_map.c (512): Checking extension for worker
 0: jkstatus of type status (6)

Can anyone see anything wrong here? Any suggestions?

Thanks,
Igor









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

Reply via email to