Is it possible to host multiple sites with Tomcat? Each site has to have its own domain name and "/"
context. I failed to find any documentation/instructions about this.
Definitely possible, and very easy. The Tomcat master configuration file conf/server.xml can contain multiple elements, each of which contains their own settings and webapp definitions. Tomcat will match incoming requests against these hosts (host aliases are also supported) and forward the request to the correct webapp.
So, typically you would add a declaration with a host-specific app-base directory, then drop a WAR into that directory and it would work.
See The Host Container for specific host configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With