virtualMachinetomcat

Connect to Apache Tomcat from a different machine

For security reasons, Tomcat Manager and Tomcat Host Manager cannot be accessed over a public IP address. Both applications only work from localhost by default but you can allow remote connections by changing their configuration.

IMPORTANT: Make these applications accessible a public IP address is a significat security risk. Instead, use a secure channel such as a VPN or an SSH tunnel. Follow these instructions to remotely connect safely and reliably.

Connect to Tomcat Manager from a different machine

In order to allow remote connections to the Tomcat Manager, follow the instructions below:

  • Create the file /opt/bitnami/tomcat/conf/Catalina/localhost/manager.xml with the following content:

      <Context privileged="true" antiResourceLocking="false"
              docBase="${catalina.home}/webapps/manager">
          <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
      </Context>
    
  • Restart Tomcat:

      $ sudo /opt/bitnami/ctlscript.sh restart tomcat
    

Connect to Tomcat Host Manager from a different machine

In order to allow remote connections to the Tomcat Host Manager, follow the instructions below:

  • Create the file /opt/bitnami/tomcat/conf/Catalina/localhost/host-manager.xml with the following content:

      <Context privileged="true" antiResourceLocking="false"
              docBase="${catalina.home}/webapps/host-manager">
          <Valve className="org.apache.catalina.valves.RemoteAddrValve" allow="^.*$" />
      </Context>
    
  • Restart Tomcat:

      $ sudo /opt/bitnami/ctlscript.sh restart tomcat
    
Last modification December 21, 2022