André Warnier a écrit le 26/08/2010 14:14:
arnaud icard wrote:
httpd is stopped.
Here is what I have done in the /opt/tomcat/conf/server.xml :
/<Engine name="Catalina" defaultHost="tomcat00c">
...
<Host name="tomcat00c" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="/var/log/tomcat/hosts/"
prefix="tomcat00c_access_log." suffix=".log"
pattern="common" resolveHosts="false"/>
</Host>
<Host name="cas" appBase="/home/tomcat/hosts/cas/webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="/var/log/tomcat/hosts/"
prefix="cas_access_log." suffix=".log"
pattern="common" resolveHosts="false"/>
</Host>
<Host name="appli1" appBase="/home/tomcat/hosts///appli1///webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="/var/log/tomcat/hosts/"
prefix="//appli1//_access_log." suffix=".log"
pattern="common" resolveHosts="false"/>
</Host>
</Engine>/
When connecting to appli1.test.fr, I am redirected to the default
ROOT content (which means to the tomcat00c host).
I am a little lost now in this tomcat jungle. No black smoke so far
hopefully :)
It is very simple, really :
1) The defaultHost (as named in the Engine tag) is the one which will
serve the request (any request), when Tomcat is unable to match the
request's hostname *exactly* with one of the <Host> tags' name attribute.
In your case, you have a Host with name="appli1", but the request says
"appli1.test.fr". That does not match ("appli1" != "appl1.test.fr").
So Tomcat defaults to the defaultHost "tomcat00c".
(Under Apache httpd, the default VirtualHost is the first one named,
from top to bottom.
In Tomcat, the order does not matter, since you explicitly say which
one is the defaultHost, in the Engine tag.)
2) something similar would happen with the application's name :
A request for "http://appli1.test.fr/appli1" would normally be mapped
to the Context "/appli1" in the Host named "appli11.test.fr". But
instead (see (1)), it gets mapped to the defaultHost. And this
defaultHost does not have an application named "appli1", so the
request gets mapped to the default application (ROOT) in the
defaultHost (tomcat00c), inside which Tomcat will be looking for a
subdirectory (catalina_base)/webapps/ROOT/appli1, and probably not
find it.
Yes this is where I made a mistake.
The parameters "name" and "defaultHost" must be the FULL name (i.e.
hostname.domain)
3) you have far too many repeated "//" in your Host appli1. I am
quite sure that the prefix for the access log will not work as shown.
These "//" does not come from my server.xml
Copy/Paste or mail server problem.
Thus no big deal but thanks for the comment.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org