Installation
Mac OS X
maltronic.io: easily install apache tomcat on Mac OS X.
brew install tomcat
# Homebrew keeps packages (known as kegs) in the Cellar, where you can check config and data files.
ls /usr/local/Cellar/
# Verify the Tomcat installation using homebrew’s handy “services” utility:
brew services list
brew services --help
catalina run
# Goto: http://localhost:8080/
# Modify username and password:
vim /usr/local/Cellar/tomcat/[version]/libexec/conf/tomcat-users.xml
# <user username="admin" password="password" roles="tomcat,manager-gui" />
# Now you can go to:
# http://localhost:8080/manager/html
# Deployed applications are usually then located under the directory:
/usr/local/Cellar/tomcat/[version]/libexec/webapps/
Deploy a web app
It is NOT recommended to place "Context" elements directly in the server.xml file. This is because it makes modifying the Context configuration more invasive since the main conf/server.xml file cannot be reloaded without restarting Tomcat. apache.org: context parameters.
Context elements may be explicitly defined:
- In the $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps.
- In the $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host.
- In individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory. For example: "/usr/local/Cellar/tomcat/8.5.14/libexec/conf/Catalina/localhost/context.xml". The name of the file (less the .xml) extension will be used as the context path. Multi-level context paths may be defined using #, e.g. foo#bar.xml for a context path of /foo/bar. The default web application may be defined by using a file called ROOT.xml.