Apache Tomcat Configuration

How to split Apache Tomcat installation (catalina home) and configuration (catalina base)? Tomcat best practice.

When you download Apache Tomcat, you have installation and configuration in one place. That is not best practice. Why? Because usually you make some changes to Tomcat configuration. What if you later wanted to upgrade your installation? You would have to merge the new Tomcat installation with your custom configuration. How to avoid this mess? You just simply split Tomcat into two parts:


1. installation (Catalina Home) 
2. configuration (Catalina Base) 


What is in each part? Installation contains bin directory and libraries. Configuration contains the rest with your custom libraries. What binds them together is a system variable CATALINA_BASE. In practice you run Tomcat from Tomcat installation, which loads configuration and starts Tomcat.


Let's see if it works. I downloaded an application from my GitHub account where I have lot's of example open source web applications for Java programmers. Let's copy the WAR inside ${catalina.base}/webapps. If the application is deployed, then the Tomcat uses this configuration.