If we place a war
file inside webapps
folder of tomcat then it deploys it when we start the server, but it is not the case when we place the war
file inside a sub folder of webapps
.
Is there any way by which we can achieve this deployment process within sub directory of webapps
?

- 1,135
- 1
- 17
- 37
-
[Please use Context for deploy two sub directory](https://stackoverflow.com/questions/47891769/how-to-load-large-sql-script-against-oracle-database-using-jdbc) – Đức Trần Trung Jan 09 '19 at 10:06
-
@ĐứcTrầnTrung, link shared redirecting me to thread `how-to-load-large-sql-script-against-oracle-database-using-jdbc`. is it the same thread you wanted to share? – Vicky Jan 09 '19 at 10:19
-
Sorry it's not correct, please take a look at [AutoDeploy a WAR file found in a subfolder of appBase](https://stackoverflow.com/questions/14523598/autodeploy-a-war-file-found-in-a-subfolder-of-appbase) – Đức Trần Trung Jan 09 '19 at 10:25
2 Answers
While using autodeploy, if you want your application to be accessed at server.com/path/app
, you can achieve this by naming your war file to "path#app.war
" before placing it into webapps directory.
During autodeploy, a directory named "path#app
" will be created under "${CATALINA_HOME}/webapps/
" and your application will be accessible at the desired URL path.
You can also choose to leave it where it is and instruct the reverse proxy in front of Tomcat to do the relocation, using ProxyPass /path/app http://tomcat-server/app
ProxyPassReverse /path/app http://tomcat-server/app
rules if the reverse proxy is Apache HTTPD. ProxyPass/ProxyPassReverse reference is available here.

- 61
- 3
We can change the war deployment path(application base directory) in TOMCAT_HOME/conf/server.xml
.
<Host name="localhost" appBase="webapps\your_directory"
unpackWARs="true" autoDeploy="true">

- 1,135
- 1
- 17
- 37