You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin Jenkins <ra...@jenkinssoftware.com> on 2013/03/31 19:50:49 UTC

Can't get name based virtual hosts to work (Windows)

I'm trying to setup name based hosts by editing server.xml.
http://masterserver2.raknet.com/ should display a different page than
http://lobby3.raknet.com/ <http://masterserver2.raknet.com/>

The DNS entries are already setup. However, no matter what URL I put, it
just goes to the localhost page (error)

<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost"  appBase="webapps/error" unpackWARs="true"
autoDeploy="true">
<Host name="masterserver2" appBase="webapps/masterserver2"
unpackWARs="true" autoDeploy="true"/>
<Host name="lobby3" appBase="webapps/lobby3" unpackWARs="true"
autoDeploy="true"/>
<Host name="milestone.masterserver2" appBase="webapps/masterserver2"
unpackWARs="true" autoDeploy="true"/>
<Host name="milestone.lobby3" appBase="webapps/lobby3" unpackWARs="true"
autoDeploy="true"/>

Re: Can't get name based virtual hosts to work (Windows)

Posted by Mark Eggers <it...@yahoo.com>.
On 3/31/2013 1:32 PM, Kevin Jenkins wrote:
> Thanks but I had already tried variations on the URL in Host name that
> before posting. Right now it's going to defaultHost (currently set to
> masterserver2.raknet.com) even though I enter http://lobby3.raknet.com/ in
> my webbrowser
>
> <Engine name="Catalina" defaultHost="localhost">
> <Host name="localhost"  appBase="webapps/masterserver2" unpackWARs="true"
> autoDeploy="true">
> <Host name="masterserver2.raknet.com" appBase="webapps/masterserver2"
> unpackWARs="true" autoDeploy="true"/>
> <Host name="lobby3.raknet.com" appBase="webapps/lobby3" unpackWARs="true"
> autoDeploy="true"/>
> <Host name="milestone.masterserver2.raknet.com"
> appBase="webapps/masterserver2" unpackWARs="true" autoDeploy="true"/>
> <Host name="milestone.lobby3.raknet.com" appBase="webapps/lobby3"
> unpackWARs="true" autoDeploy="true"/>
>
> Right now I just have an A record DNS pointing to the server IP address. Do
> I need to set some other kind of setting than the above change to
> server.xml?
>
>
> On Sun, Mar 31, 2013 at 11:13 AM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 31/03/2013 18:50, Kevin Jenkins wrote:
>>> I'm trying to setup name based hosts by editing server.xml.
>>> http://masterserver2.raknet.com/ should display a different page than
>>> http://lobby3.raknet.com/ <http://masterserver2.raknet.com/>
>>>
>>> The DNS entries are already setup. However, no matter what URL I put, it
>>> just goes to the localhost page (error)
>>>
>>> <Engine name="Catalina" defaultHost="localhost">
>>> <Host name="localhost"  appBase="webapps/error" unpackWARs="true"
>>> autoDeploy="true">
>>> <Host name="masterserver2" appBase="webapps/masterserver2"
>>> unpackWARs="true" autoDeploy="true"/>
>>
>> You need to use the full DNS name for the name attribute of the host. I.e.:
>>
>> <Host name="masterserver2.raknet.com" ...
>>
>> Mark
>>
>>> <Host name="lobby3" appBase="webapps/lobby3" unpackWARs="true"
>>> autoDeploy="true"/>
>>> <Host name="milestone.masterserver2" appBase="webapps/masterserver2"
>>> unpackWARs="true" autoDeploy="true"/>
>>> <Host name="milestone.lobby3" appBase="webapps/lobby3" unpackWARs="true"
>>> autoDeploy="true"/>

Kevin,

You do not want each named virtual host in the same webapps directory. 
At best, you'll get double deployment. At worst, you won't get what you 
expect (the behavior you're currently seeing).

The Wiki document I referenced explains exactly how to do this. It works 
fine for Windows (change paths to reflect Windows particulars) and 
Linux. It works fine in production as well as development.

Simply put:

1. Create three directories OUTSIDE of %CATALINA_HOME%\webapps
2. For each named virtual host do the following:

<Host name="fully-qualified-hostname"
       appBase="absolute-path-to-directory"
       unpackWARs="true"
       autoDeploy="true"/>

3. If you want short-named aliases, change the above to:


<Host name="fully-qualified-hostname"
       appBase="absolute-path-to-directory"
       unpackWARs="true"
       autoDeploy="true">
       <Alias>short-name-one</Alias>
       <Alias>short-name-two</Alias>
</Host>

4. Place a ROOT.war in each of the directories (case is important)

5. If you want a Manager application for each named virtual host:
    a. By copying
       1. Copy manager folder to appBase specified above
       2. Copy manager.xml from localhost to

%CATALINA_BASE%\conf\fully-qualified-hostname\manager.xml

    b. By referencing
       1. Copy manager.xml from localhost to

%CATALINA_BASE%\conf\fully-qualified-hostname\manager.xml

       2. Add a docBase attribute to point to the localhost manager
          application

. . . . just my two cents.
/mde/

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


Re: Can't get name based virtual hosts to work (Windows)

Posted by Kevin Jenkins <ra...@jenkinssoftware.com>.
Finally got it working. Thanks to those that helped.

<Host name="localhost"  appBase="webapps/error" unpackWARs="true"
autoDeploy="true">

<Host name="www.masterserver2.raknet.com" appBase="webapps/masterserver2"
unpackWARs="true" autoDeploy="true">
<Alias>masterserver2.raknet.com</Alias>
<Alias>milestone.masterserver2.raknet.com</Alias>
    <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
           prefix="masterserver2.raknet.com_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />
  </Host>
<Host name="www.lobby3.raknet.com" appBase="webapps/lobby3"
unpackWARs="true" autoDeploy="true">
<Alias>lobby3.raknet.com</Alias>
<Alias>milestone.lobby3.raknet.com</Alias>
    <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"
           prefix="lobby3.raknet.com_access_log." suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />
  </Host>




On Sun, Mar 31, 2013 at 1:32 PM, Kevin Jenkins
<ra...@jenkinssoftware.com>wrote:

> Thanks but I had already tried variations on the URL in Host name that
> before posting. Right now it's going to defaultHost (currently set to
> masterserver2.raknet.com) even though I enter http://lobby3.raknet.com/ in
> my webbrowser
>
> <Engine name="Catalina" defaultHost="localhost">
> <Host name="localhost"  appBase="webapps/masterserver2" unpackWARs="true"
> autoDeploy="true">
> <Host name="masterserver2.raknet.com" appBase="webapps/masterserver2"
> unpackWARs="true" autoDeploy="true"/>
> <Host name="lobby3.raknet.com" appBase="webapps/lobby3" unpackWARs="true"
> autoDeploy="true"/>
> <Host name="milestone.masterserver2.raknet.com"
> appBase="webapps/masterserver2" unpackWARs="true" autoDeploy="true"/>
> <Host name="milestone.lobby3.raknet.com" appBase="webapps/lobby3"
> unpackWARs="true" autoDeploy="true"/>
>
> Right now I just have an A record DNS pointing to the server IP address.
> Do I need to set some other kind of setting than the above change to
> server.xml?
>
>
> On Sun, Mar 31, 2013 at 11:13 AM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 31/03/2013 18:50, Kevin Jenkins wrote:
>> > I'm trying to setup name based hosts by editing server.xml.
>> > http://masterserver2.raknet.com/ should display a different page than
>> > http://lobby3.raknet.com/ <http://masterserver2.raknet.com/>
>> >
>> > The DNS entries are already setup. However, no matter what URL I put, it
>> > just goes to the localhost page (error)
>> >
>> > <Engine name="Catalina" defaultHost="localhost">
>> > <Host name="localhost"  appBase="webapps/error" unpackWARs="true"
>> > autoDeploy="true">
>> > <Host name="masterserver2" appBase="webapps/masterserver2"
>> > unpackWARs="true" autoDeploy="true"/>
>>
>> You need to use the full DNS name for the name attribute of the host.
>> I.e.:
>>
>> <Host name="masterserver2.raknet.com" ...
>>
>> Mark
>>
>> > <Host name="lobby3" appBase="webapps/lobby3" unpackWARs="true"
>> > autoDeploy="true"/>
>> > <Host name="milestone.masterserver2" appBase="webapps/masterserver2"
>> > unpackWARs="true" autoDeploy="true"/>
>> > <Host name="milestone.lobby3" appBase="webapps/lobby3" unpackWARs="true"
>> > autoDeploy="true"/>
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>

RE: Can't get name based virtual hosts to work (Windows)

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Kevin Jenkins [mailto:rakkar@jenkinssoftware.com] 
> Subject: Re: Can't get name based virtual hosts to work (Windows)

Don't top post.  It's annoying and confusing.

> Thanks but I had already tried variations on the URL in Host name that
> before posting. Right now it's going to defaultHost (currently set to
> masterserver2.raknet.com) even though I enter http://lobby3.raknet.com/ in
> my webbrowser

Turn on access logging to see exactly what's being sent in for Tomcat to evaluate.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Can't get name based virtual hosts to work (Windows)

Posted by Kevin Jenkins <ra...@jenkinssoftware.com>.
Thanks but I had already tried variations on the URL in Host name that
before posting. Right now it's going to defaultHost (currently set to
masterserver2.raknet.com) even though I enter http://lobby3.raknet.com/ in
my webbrowser

<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost"  appBase="webapps/masterserver2" unpackWARs="true"
autoDeploy="true">
<Host name="masterserver2.raknet.com" appBase="webapps/masterserver2"
unpackWARs="true" autoDeploy="true"/>
<Host name="lobby3.raknet.com" appBase="webapps/lobby3" unpackWARs="true"
autoDeploy="true"/>
<Host name="milestone.masterserver2.raknet.com"
appBase="webapps/masterserver2" unpackWARs="true" autoDeploy="true"/>
<Host name="milestone.lobby3.raknet.com" appBase="webapps/lobby3"
unpackWARs="true" autoDeploy="true"/>

Right now I just have an A record DNS pointing to the server IP address. Do
I need to set some other kind of setting than the above change to
server.xml?


On Sun, Mar 31, 2013 at 11:13 AM, Mark Thomas <ma...@apache.org> wrote:

> On 31/03/2013 18:50, Kevin Jenkins wrote:
> > I'm trying to setup name based hosts by editing server.xml.
> > http://masterserver2.raknet.com/ should display a different page than
> > http://lobby3.raknet.com/ <http://masterserver2.raknet.com/>
> >
> > The DNS entries are already setup. However, no matter what URL I put, it
> > just goes to the localhost page (error)
> >
> > <Engine name="Catalina" defaultHost="localhost">
> > <Host name="localhost"  appBase="webapps/error" unpackWARs="true"
> > autoDeploy="true">
> > <Host name="masterserver2" appBase="webapps/masterserver2"
> > unpackWARs="true" autoDeploy="true"/>
>
> You need to use the full DNS name for the name attribute of the host. I.e.:
>
> <Host name="masterserver2.raknet.com" ...
>
> Mark
>
> > <Host name="lobby3" appBase="webapps/lobby3" unpackWARs="true"
> > autoDeploy="true"/>
> > <Host name="milestone.masterserver2" appBase="webapps/masterserver2"
> > unpackWARs="true" autoDeploy="true"/>
> > <Host name="milestone.lobby3" appBase="webapps/lobby3" unpackWARs="true"
> > autoDeploy="true"/>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: Can't get name based virtual hosts to work (Windows)

Posted by Mark Thomas <ma...@apache.org>.
On 31/03/2013 18:50, Kevin Jenkins wrote:
> I'm trying to setup name based hosts by editing server.xml.
> http://masterserver2.raknet.com/ should display a different page than
> http://lobby3.raknet.com/ <http://masterserver2.raknet.com/>
> 
> The DNS entries are already setup. However, no matter what URL I put, it
> just goes to the localhost page (error)
> 
> <Engine name="Catalina" defaultHost="localhost">
> <Host name="localhost"  appBase="webapps/error" unpackWARs="true"
> autoDeploy="true">
> <Host name="masterserver2" appBase="webapps/masterserver2"
> unpackWARs="true" autoDeploy="true"/>

You need to use the full DNS name for the name attribute of the host. I.e.:

<Host name="masterserver2.raknet.com" ...

Mark

> <Host name="lobby3" appBase="webapps/lobby3" unpackWARs="true"
> autoDeploy="true"/>
> <Host name="milestone.masterserver2" appBase="webapps/masterserver2"
> unpackWARs="true" autoDeploy="true"/>
> <Host name="milestone.lobby3" appBase="webapps/lobby3" unpackWARs="true"
> autoDeploy="true"/>
> 


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


Re: Can't get name based virtual hosts to work (Windows)

Posted by Mark Eggers <it...@yahoo.com>.
On 3/31/2013 10:50 AM, Kevin Jenkins wrote:
> I'm trying to setup name based hosts by editing server.xml.
> http://masterserver2.raknet.com/ should display a different page than
> http://lobby3.raknet.com/ <http://masterserver2.raknet.com/>
>
> The DNS entries are already setup. However, no matter what URL I put, it
> just goes to the localhost page (error)
>
> <Engine name="Catalina" defaultHost="localhost">
> <Host name="localhost"  appBase="webapps/error" unpackWARs="true"
> autoDeploy="true">
> <Host name="masterserver2" appBase="webapps/masterserver2"
> unpackWARs="true" autoDeploy="true"/>
> <Host name="lobby3" appBase="webapps/lobby3" unpackWARs="true"
> autoDeploy="true"/>
> <Host name="milestone.masterserver2" appBase="webapps/masterserver2"
> unpackWARs="true" autoDeploy="true"/>
> <Host name="milestone.lobby3" appBase="webapps/lobby3" unpackWARs="true"
> autoDeploy="true"/>
>

http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

Works on Windows, works with Tomcat 6, Tomcat 7.

. . . . just my two cents.
/mde/

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