Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache Tomcat: multiple webapps

I'm developing a webapp using Apache Tomcat. This webapp will be deployed in a server which hosts other webapps. Now, since my webapp requires the user to authenticate, I'd need to modify some files in the "conf" directory of Tomcat such as "tomcat-users.xml". The problem is that these files are shared with the other webapps. Is there a way to have a "conf" directory for my webapp which is separated from the shared one? Thank you.

like image 876
user3067088 Avatar asked Aug 07 '26 04:08

user3067088


1 Answers

Tomcat allows you to separate out configuration from the main server.xml by creating an xml file underneath $CATALINA_BASE/conf/[enginename]/[hostname] called [YourWebappName].xml.

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

This file bascially contains a <Context> element defining the webapp specific context configuration. In here you can define your own webapp specific realm with the necessary authentication parameters for your app.

This mechanism is designed so that you can modify webapp specific configuration without touching the top-level shared files in Tomcat's conf folder.

like image 182
Will Keeling Avatar answered Aug 09 '26 10:08

Will Keeling



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!