On 29/10/2010 17:15, M.Arkhypov wrote:
> 
> Dear Chuck,
> 
> thank you for your attention and reply,
> 
> we have done a few of yours advices, but without success:
> 
> 
> We have this server.xml file:
> 
>         <Host name="cntest2.de" appBase="webapps"
>               unpackWARs="true" autoDeploy="true"
>               xmlValidation="false" xmlNamespaceAware="true">
>               <Context path=""
>                        docBase="/usr/share/tomcat6/webapps/MyNetwork"
>                        reloadable="true" allowLinking="true" />
> 
>         </Host>
> 
> If we have no path defined (path="") , there are two networks starting

Tomcat will deploy an application (either a 'app.war' file or 'app'
directory) if it finds it in the Host's configured appBase directory.

The 'appBase' is not the same an Apache HTTPD DocumentRoot directory.


> (catalina.out - part)
> INFO: Initializing Mojarra (1.2_12-b01-FCS) for context ''
> 
> and later
> 
> (catalina.out - part)
> INFO: Initializing Mojarra (1.2_12-b01-FCS) for context '/MyNetwork'

Probably because Tomcat is deploying one instance as the ROOT
application, because you have configured the Context definition and once
for the MyNetwork directory it finds in the appBase.

> we can access the page by  http://cntest2.de/ -> and get redirected to
> http://cntest2.de/login.html.
> 
> If we define the path like path="/MyNetwork".
> 
>         <Host name="cntest2.de" appBase="webapps"
>               unpackWARs="true" autoDeploy="true"
>               xmlValidation="false" xmlNamespaceAware="true">
>               <Context path="/MyNetwork"
>                        docBase="/usr/share/tomcat6/webapps/MyNetwork"
>                        reloadable="true" allowLinking="true" />
>         </Host>
> 
> And starts only one network:

As Chuck tried to tell you.  Do NOT define the Context in server.xml.
Please just completely remove all Context definitions from server.xml.


> (catalina.out - part)
> INFO: Initializing Mojarra (1.2_12-b01-FCS) for context
> '/CompetenceNetwork'
> 
> The page http://cntest2.de/MyNetwork/login.html works fine.
> 
> But if we go to the page http://cntest2.de/ the index.html from ROOT is
> showing.
> 
> So now we did what you said and copied the MyNetwork content (subfolder
> and files) to the ROOT directory. Then we see the loginpage of MyNetwork
> as expected. But now if we try to login we get URL-"redirected" to:

The ROOT directory is actually an application, you may have corrupted
the application by just copying over the content.  It would be better to
have renamed your MyNetwork directory to become the ROOT directory.


> http://cntest2.de/pages/#{subUserSessionUtil.startPageAddress}

(See below)

> There is no error shown in the catalina.out, but the
> #{subUserSessionUtil.startPageAddress} looks like an uninterpreted
> handler call. That works if we access
> the network with http://cntest2.de:8080/MyNetwork/login.html. The goal
> is to access the network by its configured URL-pattern ->
> http://cntest2.de/login.html
> (and do login etc.)
> 
> The question: how can we adjust the server.xml and work with url 
> http://cntest2.de/login.html , not with
> http://cntest2.de/MyNetwork/login.html ?

As above.  Completely remove the Context definition from server.xml.

> Tnank you
> 
> ////////////////////////////
> 
> conf. from apache2:
> 
> vhost_cn.conf
> 
>   # Update this path to match your conf directory location (put
> workers.properties next to httpd.
>   # JkWorkersFile /etc/tomcat6/workers.properties
>   # Where to put jk shared memory
>   # Update this path to match your local state directory or logs directory
>   JkShmFile     /var/log/apache2/mod_jk.shm
>   # Where to put jk logs
>   #mmm:
>   JkWorkersFile   /usr/share/tomcat6/conf/worker.properties
>   #
>   # Update this path to match your logs directory location (put
> mod_jk.log next to access_log)
>   JkLogFile     /var/log/apache2/mod_jk.log
>   # Set the jk log level [debug/error/info]
>   JkLogLevel   info
>   # Select the timestamp log format
>   JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
> 
> NameVirtualHost *
> 
> <VirtualHost *>
>  DocumentRoot /usr/share/tomcat6/webapps/MyNetwork

*Never* map an HTTPD DocumentRoot to the same directory as a Tomcat.

It is a security risk and it will almost certainly result in your
application serving files that are not properly processed by Tomcat.


>  JkMount /* worker1
> ..
>   # Serve html, jpg and gif using httpd
>   JkUnMount /*.html ajp13
>   JkUnMount /*.jpg  ajp13
>   JkUnMount /*.gif  ajp13

Why use HTTPD to serve these files?  Tomcat can do the job perfectly well.

If you must use HTTPD with Tomcat, arrange the directory structures so
that the two servers do not serve files from the same directory, like this:

 /sites/www.foo.com/static
 /sites/www.foo.com/static/images
 /sites/www.foo.com/webapps/
 /sites/www.foo.com/webapps/ROOT
 /sites/www.foo.com/webapps/MyApplication

In httpd.conf

 DocumentRoot /sites/www.foo.com/static

In server.xml:

 <Host name="www.foo.com" appBase="/sites/www.foo.com/webapps" ... >


p

>  ServerName cntest2.de
>  ServerAdmin i...@cntest2.de
>  <Directory "/usr/share/tomcat6/webapps/MyNetwork">
>   Options Indexes MultiViews
>   AllowOverride none
>   Allow from all
>  </Directory>
> <Location "/WEB-INF/">
>    #AllowOverride None
>    deny from all
> </Location>
> 
> #RewriteEngine On
> Options +FollowSymLinks
> 
> /////////////////////////////////
> 
> Am 27.10.2010, 17:44 Uhr, schrieb Caldarale, Charles R
> <chuck.caldar...@unisys.com>:
> 
>>> From: M.Arkhypov [mailto:mykhaylo.arkhy...@gmx.net]
>>> Subject: How to start my application without localhost, only with
>>> virtiual host ?
>>
>>> I would like to start my application without localhost,
>>> only with virtiual host.
>>
>> All <Host> elements are virtual.  The name "localhost" in the <Engine>
>> and one <Host> element has nothing to do with 127.0.0.1, but rather it
>> simply links the <Engine> to the default <Host>.  You must always have
>> one default <Host>, but it can be any of your <Host> elements.
>>
>>> <Host name="mmmtest.ch"
>>>       unpackWARs="true" autoDeploy="true"
>>>       xmlValidation="false" xmlNamespaceAware="true">
>>>   <Alias>mmmtest.ch</Alias>
>>
>> You're missing the appBase attribute; the value for that should be
>> unique for each <Host>.
>>
>> That's a pointless <Alias>, since it's the same as the name attribute.
>>
>>>   <Context path=""
>>>            docBase="c:/temp_mmm/apache-tomcat-6.0.29/webapps/examples"
>>>            reloadable="true" allowLinking="true" >
>>>   </Context>
>>
>> It's extremely bad practice to put <Context> elements in server.xml,
>> and very dangerous to share webapps across multiple <Host> elements.
>>
>>> The tomcatmanager is reachable on:
>>> http://mmmtest.ch:8080/manager/html.
>>
>> Only because both <Host> elements are sharing appBase - a really bad
>> idea.
>>
>>> <Host name="pcd-testcommunity.de"
>>>       unpackWARs="true" autoDeploy="true"
>>>       xmlValidation="false" xmlNamespaceAware="true">
>>>   <Alias>pcd-testcommunity.de</Alias>
>>
>> Another useless <Alias>.
>>
>>> <Context path=""
>>>          docBase="/var/lib/tomcat55/webapps/CompetenceNetwork"
>>>          reloadable="true" allowLinking="true" >
>>> </Context>
>>
>> Another undesirable location for a <Context> element.  The webapp
>> should be renamed to ROOT, and the <Context> element placed in
>> /var/lib/tomcat55/webapps/ROOT/META-INF/context.xml, and the path
>> attribute removed.
>>
>>> How can I work with tomcatmanager with these configurations?
>>
>> You must place a copy of the manager webapp in each <Host>'s appBase
>> directory.
>>
>>  - 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-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> 

Attachment: 0x62590808.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to