Score:0

Configure unique domains for several tomcat webapps

br flag

I follow the instructions from here and this to my server.xml file for each domain/webapp:

<Host name="domain1.com" autoDeploy="true" appBase="webapps_domain1" unpackWARs="true">
     <Alias>www.domain1.com</Alias>
     <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" resolveHosts="false"/>
</Host>

and restart the tomcat, but I cannot access the webapp using the domain after that. I also create the directory webapp_domain1 in /var/lib/tomcat9 and copy a war file to it with the name ROOT.war (also for each domain/webapp).

Anyone can tell me what I am missing here?

Romeo Ninov avatar
in flag
In `<Host` add different `docBase` to the specific app
Kleber Mota avatar
br flag
can you give an example for that?
Kleber Mota avatar
br flag
I add to the tag `Host`: `<Context path="" docBase="ROOT" debug="0" reloadable="true"/> `, and still got the same problem.
Romeo Ninov avatar
in flag
No, docBase should point to the directory where the different app is deployed. Check this answer: https://stackoverflow.com/a/54366546/2908599
Kleber Mota avatar
br flag
After follow the instructions in the answer, I have this in my `server.xml` file: https://pastebin.com/GGjSQqCH. And I have created a `ROOT.xml` file in the directory `conf/<domain>` for each domain with this content: `Context docBase="/var/lib/tomcat9/webapps_loja/ROOT.war" path=""></Context>`. But the problem continues.
Kleber Mota avatar
br flag
nevermind, I just solve the problem now. I had to change the port for tomcat from 8080 to 80 (I figure out this when I notice I could access the webapp with http://domain1:8080 instead of only http://domain1)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.