Apache Tomcat: several webapps

I am developing a webapp using Apache Tomcat. This webapp will be deployed on a server hosting other webapps. Now, since my webapp requires authentication from the user, I will need to modify some files in the Tomcat "conf" directory, for example, "tomcat-users.xml". The problem is that these files are shared with other web applications. Is there a way to create a "conf" directory for my webapp that is separate from the general? Thank.

+2
source share
1 answer

Tomcat allows you to disable the configuration from the main server.xmlone by creating an xml file under $CATALINA_BASE/conf/[enginename]/[hostname], called [YourWebappName].xml.

For instance: $CATALINA_BASE/conf/Catalina/localhost/PetClinic.xml

This file contains a basic element <Context>that defines the configuration of the webapp context. Here you can define your own webapp area with the necessary authentication parameters for your application.

This mechanism is designed so that you can change the configuration of the web application without touching the top-level shared files in the Tomcat folder conf.

+2
source

All Articles