Apache Tomcat could be installed either as a system daemon or as a standalone application in the environment of an operating system where JAVA would run (Linux, Windows, Unix, Mac).
At the moment, for the following description, most of all, a man uses Linux Ubuntu 16.04 LTS.
Depending on the operating system, several ways are available to deploy Apache Tomcat. In Ubuntu, it’s possible in several ways: via package manager APT-GET as a system daemon and unarchiving from TAR file for running it as a standalone application.
Apache Tomcat
After installing Tomcat as a standalone application, a folder inside has a structure:
To run a web application WAR-generated (or its symlink), a man needs to place the file into the web apps directory.
If an application uses a database server, which runs on the same host where Tomcat runs with the web app – in advance, the DB server should be up with a corresponding database, user, and its correct permissions. A web application configuration file should contain a user’s database name with its password.
After Tomcat starts, it will unpack the content of the WAR file to a freshly created directory with the same name.
Commands to restart a Tomcat are:
-
/etc/init.d/tomcat restart
-
/installed_tomcat_folder/bin/shutdown.sh && /installed_tomcat_folder/bin/startup.sh
If the application and file have the name ROOT.war, the folder webapps/ROOT will have its content. After Tomcat starts an application, one can open it at http://localhost:8080/ in a browser.
In another case, therefore, a man opens the application at http://localhost:8080/application_name/.
Apache Tomcat startup behaviour man configures corresponding parameters at the line in the file:
/installed_tomcat_folder/conf/server.xml
unpackWARs="true" autoDeploy="true"