The default Tomcat server does not allow remote access to the Manager and HostManager applications. This tutorial will teach you how to configure Tomcat so that remote hosts can access the Manager and HostManager applications.
Tomcat have a context file for each deployed web application under the conf/Catalina/localhost directory. It has the file with the same name as the web app like manager.xml or host-manager.xml.
So, if the file is not present, you need to create a file conf/Catalina/localhost/manager.xml and specify the rule to allow remote hosts.
sudo nano ${CATLINA_HOME}/conf/Catalina/localhost/manager.xml
Add the following content.
1 2 3 4 | <Context privileged="true" antiResourceLocking="false" docBase="{catalina.home}/webapps/manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> </Context> |
You also need to create an XML file for the host-manager web app to allow access for remote hosts.
sudo nano ${CATLINA_HOME}conf/Catalina/localhost/host-manager.xml
Add the following content.
1 2 3 4 | <Context privileged="true" antiResourceLocking="false" docBase="{catalina.home}/webapps/host-manager"> <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" /> </Context> |
After you create the XML files, you must restart the Apache server in order to read the new files. Now, when you access the manager or host-manager web app, you will be prompted for authentication.