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
name="localhost"
- name of the serverappBase="webapps"
- working directory of tomcat where applications are deployedunpackWARs="true"
- if tomcat should unpack war files.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
absolute path
to the directory where you want to deploy apps.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: