Reputation: 6613
I have one domain hosted on cloud server. Let's say o.com
Now i want to add a.com and b.com to same cloud server, for that , i added host entries inside server.xml as below,
<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 "%r" %s %b" />
</Host>
<Host name="a.com" appBase="webapps_a"></Host>
<Host name="b.com" appBase="webapps_b"></Host>
(Note, Localhost was the orignal entry)
But , problem is , they both are pointing to o.com and not to their respective domains/webapp directories
Upvotes: 0
Views: 121
Reputation: 4403
You can do that with a Apache HTTP Server in front of tomcat. In Apache2, you can define different servers handling requests to different URLs in enabled-sites folder, then link to different applications running on a single tomcat instance through a reverse proxy.
Upvotes: 1