You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by 29djeo <29...@michaelstarkie.com> on 2003/12/20 19:34:03 UTC

virtual hosting? anyone succeed?

Has anyone succeeded in getting tomcat 5.0.16 set up for virtual hosting without using apache as a front end?

I'm trying to get one instance of tomcat to serve two domains on the same machine.

I have added two Host sections to server.xml and I see the following behavior when I access the sites from a browser running on the same host as tomcat:

http://localhost:8080 - default context
http://www.mydomain1.com - blank page
http://www.mydomain2.com - blank page
http://mydomain1:8080 - correctly runs the mydomain1 context
http://mydomain2:8080 - correctly runs the mydomain2 context

how do I get www.mydomain1.com and www.mydomain2.com to show the correct contexts?

from another host on my network the only context I can load is http://hostname:8080 to see the default context.  All other contexts like http://www.mydomain1.com and http://domain1.com:8080 result in an "action cancelled" from ineternet explorer.

Here is an excerpt from server.xml:

   <Service name="Catalina">
      <Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" />
      <Connector port="8009" enableLookups="false" redirectPort="8443" debug="0" protocol="AJP/1.3"/>
      <Engine name="Catalina" defaultHost="localhost" debug="0">
         <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
         <Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase"/>
         <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
            <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="localhost_log." suffix=".txt"/>
         </Host>
         <Host name="mydomain1.com" debug="0" appBase="webapps" unpackWARs="true">
            <Alias>www.mydomain1.com</Alias>
            <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="mydomain1." suffix=".log" timestamp="true"/>
            <Context path="" docBase="mydomain1" debug="0" reloadable="true"/>
         </Host>
         <Host name="mydomain2.com" debug="0" appBase="webapps" unpackWARs="true">
            <Alias>www.mydomain2.com</Alias>
            <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="mydomain2." suffix=".log" timestamp="true"/>
            <Context path="" docBase="mydomain2" debug="0" reloadable="true"/>
         </Host>
      </Engine>
   </Service>

Re: virtual hosting? anyone succeed?

Posted by Leandro Costa <ld...@tutopia.com>.
Look at the logs, something is fubar'd, that's why you see a 'blank page'

On Sat, 20 Dec 2003 14:34:03 -0400
"29djeo" <29...@michaelstarkie.com> wrote:

> Has anyone succeeded in getting tomcat 5.0.16 set up for virtual hosting without using apache as a front end?
> 
> I'm trying to get one instance of tomcat to serve two domains on the same machine.
> 
> I have added two Host sections to server.xml and I see the following behavior when I access the sites from a browser running on the same host as tomcat:
> 
> http://localhost:8080 - default context
> http://www.mydomain1.com - blank page
> http://www.mydomain2.com - blank page
> http://mydomain1:8080 - correctly runs the mydomain1 context
> http://mydomain2:8080 - correctly runs the mydomain2 context
> 
> how do I get www.mydomain1.com and www.mydomain2.com to show the correct contexts?
> 
> from another host on my network the only context I can load is http://hostname:8080 to see the default context.  All other contexts like http://www.mydomain1.com and http://domain1.com:8080 result in an "action cancelled" from ineternet explorer.
> 
> Here is an excerpt from server.xml:
> 
>    <Service name="Catalina">
>       <Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" debug="0" connectionTimeout="20000" disableUploadTimeout="true" />
>       <Connector port="8009" enableLookups="false" redirectPort="8443" debug="0" protocol="AJP/1.3"/>
>       <Engine name="Catalina" defaultHost="localhost" debug="0">
>          <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
>          <Realm className="org.apache.catalina.realm.UserDatabaseRealm" debug="0" resourceName="UserDatabase"/>
>          <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
>             <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"  prefix="localhost_log." suffix=".txt"/>
>          </Host>
>          <Host name="mydomain1.com" debug="0" appBase="webapps" unpackWARs="true">
>             <Alias>www.mydomain1.com</Alias>
>             <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="mydomain1." suffix=".log" timestamp="true"/>
>             <Context path="" docBase="mydomain1" debug="0" reloadable="true"/>
>          </Host>
>          <Host name="mydomain2.com" debug="0" appBase="webapps" unpackWARs="true">
>             <Alias>www.mydomain2.com</Alias>
>             <Logger className="org.apache.catalina.logger.FileLogger" directory="logs" prefix="mydomain2." suffix=".log" timestamp="true"/>
>             <Context path="" docBase="mydomain2" debug="0" reloadable="true"/>
>          </Host>
>       </Engine>
>    </Service>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: virtual hosting? anyone succeed?

Posted by George Sexton <gs...@mhsoftware.com>.
I run about 6-8 virtual hosts on one installation. I created them using
the Admin application and had no problems.

-----Original Message-----
From: 29djeo [mailto:29djeo@michaelstarkie.com] 
Sent: Saturday, December 20, 2003 11:34 AM
To: tomcat-user@jakarta.apache.org
Subject: virtual hosting? anyone succeed?


Has anyone succeeded in getting tomcat 5.0.16 set up for virtual hosting
without using apache as a front end?

I'm trying to get one instance of tomcat to serve two domains on the
same machine.

I have added two Host sections to server.xml and I see the following
behavior when I access the sites from a browser running on the same host
as tomcat:

http://localhost:8080 - default context
http://www.mydomain1.com - blank page
http://www.mydomain2.com - blank page
http://mydomain1:8080 - correctly runs the mydomain1 context
http://mydomain2:8080 - correctly runs the mydomain2 context

how do I get www.mydomain1.com and www.mydomain2.com to show the correct
contexts?

from another host on my network the only context I can load is
http://hostname:8080 to see the default context.  All other contexts
like http://www.mydomain1.com and http://domain1.com:8080 result in an
"action cancelled" from ineternet explorer.

Here is an excerpt from server.xml:

   <Service name="Catalina">
      <Connector port="8080" maxThreads="150" minSpareThreads="25"
maxSpareThreads="75" enableLookups="false" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
disableUploadTimeout="true" />
      <Connector port="8009" enableLookups="false" redirectPort="8443"
debug="0" protocol="AJP/1.3"/>
      <Engine name="Catalina" defaultHost="localhost" debug="0">
         <Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt" timestamp="true"/>
         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
         <Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true" xmlValidation="false"
xmlNamespaceAware="false">
            <Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"  prefix="localhost_log." suffix=".txt"/>
         </Host>
         <Host name="mydomain1.com" debug="0" appBase="webapps"
unpackWARs="true">
            <Alias>www.mydomain1.com</Alias>
            <Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="mydomain1." suffix=".log" timestamp="true"/>
            <Context path="" docBase="mydomain1" debug="0"
reloadable="true"/>
         </Host>
         <Host name="mydomain2.com" debug="0" appBase="webapps"
unpackWARs="true">
            <Alias>www.mydomain2.com</Alias>
            <Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="mydomain2." suffix=".log" timestamp="true"/>
            <Context path="" docBase="mydomain2" debug="0"
reloadable="true"/>
         </Host>
      </Engine>
   </Service>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org