Ready-to-use server

Tomcat on Apache

Java Servlet and JSP Platform

Tomcat on Apache screenshots

Tomcat is a servlet container that implements the Java Servlet and the JavaServer Pages (JSP) specifications, and provides a "pure Java" HTTP web server environment for Java code to run in. Tomcat powers numerous large-scale, mission-critical web applications across a diverse range of industries and organizations.

This appliance integrates Tomcat with the Apache web server. When a fully featured web server is not required, consider using the Standalone Tomcat Appliance.

This appliance includes all the standard features in TurnKey Core, and on top of that:

  • Tomcat on Apache configurations:

    • TurnKey web control panel in /var/lib/tomcat10/webapps/cp

      The default Apache index file (/var/www/index.html) uses javascript to redirect the root web page to the control panel:

      window.location = "/cp/"
    • Tomcat 10.1 and all components installed from package management.

    • Using the OpenJDK 21 Java runtime from Debian.

    • Deployed web applications in /var/lib/tomcat10/webapps.

    • TurnKey web control panel in /var/lib/tomcat10/webapps/cp.

    • JSP console output available through the systemd journal.

    • Created Tomcat admin/manager roles and admin user.

    • Use Apache2 Jk loadbalancer connector (performance).

    • JkMounts for admin, manager, host-manager applications (convenience).

    • Bind Tomcat AJP connector to localhost (security).

    • Removed Tomcat HTTP connector listener (security).

    • Set system wide Tomcat and Java environment variables.

  • Includes MariaDB, a MySQL-compatible database server.

  • SSL support out of the box.

  • Includes Webmin modules for configuring Apache2 and MariaDB.

See the Tomcat on Apache docs for further details.

Credentials (passwords set at first boot)

  • Webmin, SSH, MariaDB: username root

  • Tomcat administration applications: username admin

Usage details & Logging in for Administration

No default passwords: For security reasons there are no default passwords. All passwords are set at system initialization time.

Ignore SSL browser warning: browsers don't like self-signed SSL certificates, but this is the only kind that can be generated automatically. If you have a domain configured, then via Confconsole Advanced menu, you can generate free Let's Encypt SSL/TLS certificates.

Web - point your browser at either:

  1. http://12.34.56.789/ - not encrypted so no browser warning
  2. https://12.34.56.789/ - encrypted with self-signed SSL certificate

Note: some appliances auto direct http to https.

Username for tomcat administration applications:

Login as username admin

Username for database administration:

  1. Adminer; login as MySQL username adminer:

    https://12.34.56.789:12322/ - Adminer database management web app

  2. MySQL command line tool; log in as root (no password required):
    $ mysql --user root
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql>
    

Username for OS system administration:

Login as root except on AWS marketplace which uses username admin.

  1. Point your browser to:
  2. Login with SSH client:
    ssh root@12.34.56.789
    

    Special case for AWS marketplace:

    ssh admin@12.34.56.789
    

* Replace 12.34.56.789 with a valid IP or hostname.

Documentation

Serving up a different web root (not the control panel)

The default web root redirects to the TurnKey control panel. To change that, there is difference between Turnkey version.

Version 14.2 and higher

You can change that by deleting or replacing this Javascript code which written on index.html (located at var/www/ by default):

window.location = "/cp"

Lower than version 14.2

You can change that by either:

  1. Configuring a virtual host at the Apache-level via Webmin
  2. Changing the mod_jk configuration by editing /etc/tomcat6/mod_jk.conf.

Replace:

RedirectMatch ^/$ /cp

With:

RedirectMatch ^/$ /index.html

Configuring mod_jk to serve applets

For example let's say you want to install Apache Axis:

For example, if axis is located in the webapps directory, you would add something like the following to the mod_jk configuration in /etc/tomcat6/mod_jk.conf:

JkMount /axis    ajp13_worker
JkMount /axis/*  ajp13_worker


When you browse to http://appliance_ip/axis it would be proxied back to tomcat via apache. If you would like to have axis served at the webroot (well, redirected from webroot), you can implement a redirect like:

RedirectMatch ^/$   /axis
JkMount /axis    ajp13_worker
JkMount /axis/*  ajp13_worker

Please note that you will have to remove the welcome redirectmatch.
For more information on mod_jk, take a look at the Apache Tomcat Connectors documentation