2

I have installed Apache tomcat 8 on my windows server 2012 where I need to store my Java applications. I have 3 apps: app1, app2, app3

Right now if I put into my - Tomcat 8.0\webapps folder war file called ROOT.war app starts on address mydomain.com and works fine - but I need to be able to run several apps at the same tomcat - Thats's why I want to create subdomains

app1 should launch on app1.mydomain.com app2 should launch on app2.mydomain.com app3 should launch on app3.mydomain.com 

How can I fulfill this?

I search similar topics here on stack-overflow but nothing helped.

Please help.

4
  • Why not run each application on a different port, and let a web server manage that for you? Commented Feb 19, 2016 at 18:59
  • This application should be used by customers - for them it will be easier to remember app1.mydomain.com rather then app1.mydomain.com:8252 :) Commented Feb 19, 2016 at 20:23
  • You missed the point I was making. The applications run on different ports. However the web server will handle the subdomain mapping. app1.mydomain.com will point to port 80, but the web server will map it to localhost:8252 Commented Feb 19, 2016 at 20:29
  • Something like... confluence.atlassian.com/doc/… Commented Feb 19, 2016 at 20:41

1 Answer 1

4

Actually I solved my issue like this: I have configured server.xml file located in my case in Program Files (x86)\Apache Software Foundation\Tomcat 8.0\conf folder

found there this code:

 <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> 

made a copy of it and replaced the values with my subdomains:

 <Host name="app1.mydomain.com " appBase="app1.mydomain.com " 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> 

and that's it actually.

For myself I also removed default localhost HOST and now I have only subdomains.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.