You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeff Duska <je...@duska.com> on 2005/04/04 19:45:55 UTC

Troubleshooting Virtual Hosts with Tomcat 5 standalone mode...

I'm trying to setup a couple of virtual hosts using Tomcat in stand
alone mode. I'm having a hell of a time to get this working correctly.
I've tried several configs, but they all fail.

I started with the goal of having a user directory for each virtual
host. For example, for the sample domain1.com the appbase would be
/home/domain/webapps.

I setup my server.xml file to have the following host settings

    <Host name="domain1.com" debug="0" appBase="/home/domain/webapps"
        unpackWARs="true" autoDeploy="true"
        xmlValidation="false" xmlNamespaceAware="false">
		<Context path="" docBase="."/>
	</host>

This is pretty much cut and past from Tomcat: The Definitive Guide from
Safari Online. This did not work. I would get just get a blank webpage.

I then tried to update the host file. I didn't see why I'd need to do
that since my DNS setup at Mydomain.com was working for ssh. I add
domain1.com to the line for my localhost. I restarted Tomcat. No change.

I am able to run the system on port 80 using just the localhost default
settings. I figured I just did something wrong. I switched to this
directions http://www.ex-parrot.com/~pete/tomcat-vhost.html

This didn't worked either. When I looked at the requests in in Safari,
it showed this as a bad request. I can telnet domain1.com 80. When I try
GET index.jsp or index,html or /. Nothing happens. No error. It just
closed the connection as if everything was working fine. I tried lynx
from the server prompt. It gives a http 400 error, I think. It flashes
by so fast I'm not sure.

The catalina.out has no errors.

I have my DNS setup via mydomain.com dns management tool. I have my A
record pointing to the address. I don't think I need to do anything else.

I'm at a loss of what to do now to troubleshoot this problem. I searched
the mail list and the website nothing has jumped out at me. So, I hoping
some kind soul might give me some pointers. What kills me is I'm sure
this is something obvious I missed or not seeing.

Thanks,

Jeff Duska
jeff@duska.com



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


Re: Troubleshooting Virtual Hosts with Tomcat 5 standalone mode...

Posted by Hein Behrens <in...@curvaciones.com>.
This is in my server.xml the directory is webapps/by-m.

It works also on a linux box. It is inside the <engine>.

 <Host name="by-m" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
                <Context path="" docBase="by-m" debug="5" reloadable="true">
                </Context>
            </Host>
----- Original Message ----- 
From: "Jeff Duska" <je...@duska.com>
To: <to...@jakarta.apache.org>
Sent: Monday, April 04, 2005 7:45 PM
Subject: Troubleshooting Virtual Hosts with Tomcat 5 standalone mode...


> I'm trying to setup a couple of virtual hosts using Tomcat in stand
> alone mode. I'm having a hell of a time to get this working correctly.
> I've tried several configs, but they all fail.
>
> I started with the goal of having a user directory for each virtual
> host. For example, for the sample domain1.com the appbase would be
> /home/domain/webapps.
>
> I setup my server.xml file to have the following host settings
>
>     <Host name="domain1.com" debug="0" appBase="/home/domain/webapps"
>         unpackWARs="true" autoDeploy="true"
>         xmlValidation="false" xmlNamespaceAware="false">
> <Context path="" docBase="."/>
> </host>
>
> This is pretty much cut and past from Tomcat: The Definitive Guide from
> Safari Online. This did not work. I would get just get a blank webpage.
>
> I then tried to update the host file. I didn't see why I'd need to do
> that since my DNS setup at Mydomain.com was working for ssh. I add
> domain1.com to the line for my localhost. I restarted Tomcat. No change.
>
> I am able to run the system on port 80 using just the localhost default
> settings. I figured I just did something wrong. I switched to this
> directions http://www.ex-parrot.com/~pete/tomcat-vhost.html
>
> This didn't worked either. When I looked at the requests in in Safari,
> it showed this as a bad request. I can telnet domain1.com 80. When I try
> GET index.jsp or index,html or /. Nothing happens. No error. It just
> closed the connection as if everything was working fine. I tried lynx
> from the server prompt. It gives a http 400 error, I think. It flashes
> by so fast I'm not sure.
>
> The catalina.out has no errors.
>
> I have my DNS setup via mydomain.com dns management tool. I have my A
> record pointing to the address. I don't think I need to do anything else.
>
> I'm at a loss of what to do now to troubleshoot this problem. I searched
> the mail list and the website nothing has jumped out at me. So, I hoping
> some kind soul might give me some pointers. What kills me is I'm sure
> this is something obvious I missed or not seeing.
>
> Thanks,
>
> Jeff Duska
> jeff@duska.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>

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


Re: Troubleshooting Virtual Hosts with Tomcat 5 standalone mode...

Posted by Hassan Schroeder <ha...@webtuitive.com>.
Jeff Duska wrote:
> I'm trying to setup a couple of virtual hosts using Tomcat in stand
> alone mode.

> I started with the goal of having a user directory for each virtual
> host. For example, for the sample domain1.com the appbase would be
> /home/domain/webapps.
> 
> I setup my server.xml file to have the following host settings
> 
>    <Host name="domain1.com" debug="0" appBase="/home/domain/webapps"
>        unpackWARs="true" autoDeploy="true"
>        xmlValidation="false" xmlNamespaceAware="false">
>         <Context path="" docBase="."/>
>     </host>

OK, don't do that :-)

Don't put the Context elements in server.xml. Put your Host elements
there, e.g.

    <Host name="oahu"  appBase="/www/oahu"></Host>
    <Host name="maui"  appBase="/www/maui"></Host>	   	
    <Host name="kauai" appBase="/www/kauai"></Host>	   	  		

Then (assuming you're using the default Engine name) make directories
    $CATALINA_HOME/conf/Catalina/oahu
    $CATALINA_HOME/conf/Catalina/maui
    $CATALINA_HOME/conf/Catalina/kauai

In each of those put your Context files, as in
    $CATALINA_HOME/conf/Catalina/oahu/ROOT.xml
    $CATALINA_HOME/conf/Catalina/oahu/manager.xml
    <!-- the above if you want the manager app available -->
    $CATALINA_HOME/conf/Catalina/oahu/cowabunga.xml
    <!-- etc... -->

which will look (minimally!) like

    <Context docBase="/www/oahu/ROOT">
	<!-- define Resources, etc. -->	
    </Context>	

That's it. Restart tomcat. Done. See, wasn't that easy? :-)

HTH!
-- 
Hassan Schroeder ----------------------------- hassan@webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.



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