> -----Original Message-----
> From: Kiran Badi [mailto:ki...@poonam.org]
> Sent: Tuesday, May 12, 2015 9:30 PM
> To: Tomcat Users List
> Subject: Re: Tomcat 7.0.57 - Deployment Issue
> 
> Thanks Hassan/Prabhu/Charles for reply.
> 
> I tried the options given in this link.
> 
> http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts
> 
> but for some reasons still its not working.I have pasted the server xml
> for
> reference. I have unlimited website hosting plan with arvixe.com , but
> for
> some reasons it's still not working.Not sure if these guys needs to add
> something special to hosts file.
> 
> here is link for actual site -
> 
> homelyhotels.com - you will probably see cgi-bin folder.
> 
> Below server xml, I have added just a second host tag for webapp2. I am
> bit
> hesitant to make changes wrt to webapp1(removing context tags etc due to
> lack of time on my end along with lack of sufficient knowledge in case
> something breaks,however I will eventually clean that as well).
> 
...
>     <!-- An Engine represents the entry point (within Catalina) that
> processes
>          every request.  The Engine implementation for Tomcat stand
> alone
>          analyzes the HTTP headers included with the request, and passes
> them
>          on to the appropriate Host (virtual host).
>          Documentation at /docs/config/engine.html -->
> 
>     <!-- You should set jvmRoute to support load-balancing via AJP ie :
>     <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
>     -->
>     <Engine name="Catalina" defaultHost="localhost">
> 
>       <!--For clustering, please take a look at documentation at:
>           /docs/cluster-howto.html  (simple how to)
>           /docs/config/cluster.html (reference documentation) -->
>       <!--
>       <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
>       -->
> 
>       <!-- Use the LockOutRealm to prevent attempts to guess user
> passwords
>            via a brute-force attack -->
>       <Realm className="org.apache.catalina.realm.LockOutRealm">
>         <!-- This Realm uses the UserDatabase configured in the global
> JNDI
>              resources under the key "UserDatabase".  Any edits
>              that are performed against this UserDatabase are
> immediately
>              available for use by the Realm.  -->
>         <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
>                resourceName="UserDatabase"/>
>       </Realm>
> 
>       <Host name="localhost"  appBase="webapps"
>             unpackWARs="true" autoDeploy="true">
> 
>         <!-- SingleSignOn valve, share authentication between web
> applications
>              Documentation at: /docs/config/valve.html -->
>         <!--
>         <Valve
> className="org.apache.catalina.authenticator.SingleSignOn" />
>         -->
> 
>         <!-- Access log processes all example.
>              Documentation at: /docs/config/valve.html
>              Note: The pattern used is equivalent to using
> pattern="common"
> -->
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="localhost_access_log." suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
> 
>       </Host>
> 
>        <Host name="webapp1" appBase="/home/myhostid/tomcat/webapps">
>           <Alias>www.webapp1.com</Alias>
>           <Alias>myhostid.myserver.mywebhost.com</Alias>
>           <Context path="/manager" debug="0" privileged="true"
>               docBase="/home/myhostid/tomcat/webapps/manager">
>           </Context>
>        </Host>
>       <Host name="webapp2.com"
> appBase="/home/myhostid/hosts/webapp2/webapps" xmlValidation="false"
> xmlNamespaceAware="false" unpackWARs="true" autoDeploy="true">
>           <Alias>www.webapp2.com</Alias>
>           <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="webapp2_access_log." suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
>        </Host>
>     </Engine>
>   </Service>
> </Server>
> 
Kiran -
What no one has asked about yet is this:  What does your directory structure 
look like? Where are the catalina_home and catalina_base environment variables 
pointed?  Is it, I suspect, /home/myhostid/tomcat?
If so, then deployment of the server using the above config will result in the 
following:
For localhost and any request that comes in on the server's network interfaces 
that doesn't match your explicit host names or their alias, everything under 
the /home/myhostid/tomcat/webapps will be deployed once for the <Host> named 
"localhost". So, for example http://localhost/webapp2/webapps/ would result in 
reaching the webapp2 pages (might need to add ROOT or webapp2 to the end, but 
you could reach it).
For the <Host> named "webapp1", you will essentially re-deploy the 
application(s) that was deployed for localhost. We call that double-deployment, 
and it's something to avoid.
For the <Host> named "webapp2.com", it will only deploy the application 
webapp2, but in so doing it will unpack the war into a directory named the same 
as the war file, which makes that application now available at the other hosts.

What I'm saying is, don't nest your appBase directories.  Make sure they are 
unique.  It OK to create sub-directories under a main /home/myhostid/webapps 
directory, just make sure that no host uses a higher directory path as its 
appBase. 

As someone said, you could probably lose the localhost <Host> completely, and 
change the defaultHost setting to point to the webapp1 host. Or just add the 
aliases for webapp1 to the localhost <Host> config and delete the one for 
webapp1.  But by all means make sure that the appBases of all your hosts are 
NOT NESTED.

Also, avoid giving multiple hosts the same <Alias>.  It looks like above you 
did this already, but it won't work.

If you want the manager app for each host, you can add that with a manager.xml 
context file in each of the hosts' directories under 
{catalina_home}/conf/Catalina.

Jeff

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

Reply via email to