trzczy
trzczy

Reputation: 1501

Moving a webapps location from Tomcat 9 installation directory to another path

I installed tomcat 9 following a tutorial of https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-9-on-debian-10 so an installtion path got /opt/tomcat

Then I decided to move the webapps folder to another path on a file system. My try was to associate the path to a appBase variable in a host configuration in a conf/server.xml file in this way:

  <Host name="localhost"
    <!-- appBase="webapps" -->
        appBase="/opt/tomcat/webapps"
        unpackWARs="true" autoDeploy="true">

    <!-- SingleSignOn valve, share authentication between web applications
         Documentation at: /docs/config/valve.html -->
    <!--
    <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
    -->

    <!-- Access log processes all example.
         Documentation at: /docs/config/valve.html
         Note: The pattern used is equivalent to using pattern="common" -->
    <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="localhost_access_log" suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %s %b" />

  </Host>

This did not work so the appBase variable could not get a value of an absolute path. How to move the webapps folder to another location, for example to a user directory?

Upvotes: 0

Views: 1841

Answers (1)

Pandurang
Pandurang

Reputation: 1741

Please use the below tag in server.xml file.

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

Upvotes: 1

Related Questions