Tomcat : How to change Deployment directory from webapp to custom Directory.

How to change Working Directory of Tomcat to Custom Directory

Default Tomcat working directory is webapp. If you want to change this to some other directory then you can follow the steps below.

Open the server.xml file. You can find this file in conf/ directory of your tomcat folder.

Find the following line in the file


     <Host name="localhost"  appBase="webapps"
           unpackWARs="true" autoDeploy="true">

It states the following things

  1. name="localhost" - name of the server
  2. appBase="webapps" - working directory of tomcat where applications are deployed
  3. unpackWARs="true" - if tomcat should unpack war files.
  4. autoDeploy="true" - if tomcat should auto deploy changes

How to change Work directory of tomcat.

To change the work directory from webapp to some other directory you can give the

  1. absolute path to the directory where you want to deploy apps.
  2. relative path to the directory inside the Tomcat folder.

e.g Deploying in directory with absolute path


<Host name="localhost"  appBase="/home/ekiras/tomcat/deploy"
           unpackWARs="true" autoDeploy="true">

Deploying in directory with relative path


<Host name="localhost"  appBase="custom"
         unpackWARs="true" autoDeploy="true">

No comments :

Post a Comment