I have a tomcat server, with a webapps/ROOT application, fronted by Apache.
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
and
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
I need to add a second webapp to this box, so I unpacked it into webapps/pib.war/ and changed the Apache conf:
ProxyPass /pib http://localhost:8009/pib
ProxyPassReverse /pib http://localhost:8009/pib
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
My tomcat/conf/server.xml contains:
<Service name="Catalina">
<Connector port="8009" protocol="AJP/1.3" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
<Host name="localhost" appBase="webapps" />
</Engine>
</Service>
I have only one context.xml file - there are none under the webapps - in conf/context.xml
<Context>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>
When I visit https://myserver/ then the existing, default, ROOT application works as normal, but https://myserver/pib/ gives, in catalina.out:
org.apache.jk.common.MsgAjp processHeader
SEVERE: BAD packet signature 18245
which the intertubes suggest means I'm talking HTTP to the AJP connector, instead of AJP, yet the first webapp is working properly.
What am I missing? I've seen mention of context.xml files under each webapp, but I'm not sure what they're for or what to put in them.
I don't normally use AJP, but this box is already working that way, so I'm a little lost right now.
Thanks,
来源:https://stackoverflow.com/questions/7609081/tomcat-ajp-connector-with-multiple-webapps