André Warnier ha scritto:
Alessandro Fantuzzi wrote:
Hi ,
how do I set up Apache and Tomcat to serve two different web
applications.
One application must respond when you visit www.site.com the other
when you visit a third level domain like admin.site.com
I don't really know what you mean by "third level domain" in that
context, but in both Apache httpd and Tomcat, serving different
hostnames is usually something one does with Virtual Hosts.
That is explained for both in their respective on-line documentation
pages.
See httpd.apache.org and tomcat.apache.org.
If after reading that, you would have further questions, ask again but
I suggest that supply some details about what versions you use, on
what system(s), and your configuration.
Ok.
If I don' t go wrong the domain admin.site.com is considered to be a
"third level domain" related to www.site.com
Here are the info about production environment.
LINUX
APACHE 2.0.59
TOMCAT 5.5.20
JVM 1.5
I read the documentation for both Apache httpd and Tomcat, and I also
had some testing on my testing environment, which is somewhat different.
Windows XP Professional
APACHE 2.0.63
Tomcat 6.0.14
JVM 1.5
This is what we want to obtain:
when the user calls http://www.site.com the contents must be served by
the application intalled in /site_prod under Tomcat.
When the user calls a particular third level domain, say
http://admin.site.com the contents must be served by the application
installed in /site_admin
This is how I configured Apache httpd and Tomcat
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
httpd.conf:
here I created two VirtualHosts
<VirtualHost *:80>
ServerName admin.site.com
DocumentRoot "webapps/site_admin"
JkMount /site_admin/*.jsp worker1
JkMount /* worker1
RewriteEngine on
[...](Some rewrite rules)
[...](Log files)
</VirtualHost>
<VirtualHost *:80>
ServerName site.com
DocumentRoot "webapps/site_prod"
JkMount /site_prod/*.jsp worker1
JkMount /* worker1
[...](Some rewrite rules)
[...](Log files)
</VirtualHost>
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
In server.xml I created two Hosts
<Host appBase="webapps\" autoDeploy="true" debug="0"
name="admin.site.com" unpackWARs="true">
<Context debug="1" docBase="web\" path=""/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" pattern="common" prrefix="home_access_log."
resolveHosts="false" suffix=".txt"/>
</Host>
<Host appBase="webapps\" autoDeploy="true" debug="0" name="www.site.com"
unpackWARs="true">
<Context debug="1" docBase="web\" path=""/>
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" pattern="common" prrefix="home_access_log."
resolveHosts="false" suffix=".txt"/>
</Host>
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
What is strange is that when both applications are up and running
everithing seem to go the right way.
I mean, when I call www.site.com I get a response from the application
sitting on /site_prod
And when I call admin.site.com I get a response from the application
sitting on /site_admin
But if I turn off the application installed in /site_admin , instead of
receving an error message, I get a page from the application in /site_prod
I don' t know if this is a correct behaviour or if my configuration is
messed up.
--
Alessandro Fantuzzi - O-one s.r.l.
E-mail: fantu...@o-one.net <mailto:fantu...@o-one.net>
Software developer
www.o-one.net <http://www.o-one.net>
-------------------------------------------------------------------
Via Dante Zanichelli, 61 - 42100 Reggio Emilia
Tel. 0522 930078 - Fax. 0522 387947
-------------------------------------------------------------------
Via Stendhal, 36 - 20144 Milano
Tel 02.42292057 - Fax 02.47770936
-------------------------------------------------------------------
STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential
and proprietary material for the sole use of the intended recipient. Any
review or distribution by others is strictly prohibited. If you are not
the intended recipient please contact the sender and delete all copies.
The contents of this message that do not relate to the official business
of our company shall be understood as neither given nor endorsed by it.
-------------------------------------------------------------------