Select your language

Tomcat is a web server and servlet container for Java applications. It is developed as an open-source project by the Apache Software Foundation and is available under the Apache license 2.0.

This guide explains how to run Tomcat on your Managed Flex Server.

Requirements

The following requirements must be met to run Tomcat:

  • Tomcat can be run on Managed Flex Server M and higher.
  • Java Runtime Environment (JRE) – available on your Managed Flex Server and updated by us regularly

Installation and getting started

To complete these steps, you must be logged into your Managed Flex Server via SSH.

We recommend creating an ~/app/ directory for your own applications and then creating a subdirectory for each of your applications. This keeps everything neat and tidy at all times. So, for Tomcat, we will create the directory ~/app/tomcat.

mkdir -p ~/app/tomcat

Downloading Tomcat

To download Tomcat, navigate to the application directory you just created:

cd ~/app/tomcat

Next, download the latest version from the Tomcat website and unzip it:

wget https://www-eu.apache.org/dist/tomcat/tomcat-x/vx.x.xx/bin/apache-tomcat-x.x.xx.tar.gz 
tar xzvf apache-tomcat-x.x.xx.tar.gz

We recommend creating a symlink from ~/app/ tomcat/current to the downloaded folder to avoid having to work with version numbers in the configuration files. To create this symlink, enter the following command:

ln -s ~/app/tomcat/apache-tomcat-x.x.xx ~/app/tomcat/current

Integration

Using Custom Service Control

The Custom Service Control (CSC) can handle operations and the automatic management of your application, e.g. starting and stopping it when performing maintenance on your server.

Configuring Tomcat in the CSC is fairly simple. Set up a new custom service for Tomcat:

hpservices supervisord add tomcat
successfully created dir for tomcat: /home/username/.services/supervisord/tomcat
successfully created dir for tomcat: /home/username/.services/supervisord/tomcat/log
successfully created dir for tomcat: /home/username/app/tomcat
supervisord service config file written: /home/username/.services/supervisord/tomcat/service.conf

A configuration framework is created in the file ~/.services/supervisord/tomcat/service.conf for the new service. For Tomcat, the command has to be modified and the environment variable included as well. You can leave all other suggested values alone (delete the semicolon at the beginning of the line).

~/.services/supervisord/tomcat/service.conf
[program:tomcat]
command=%(ENV_HOME)s/app/tomcat/current/bin/catalina.sh run ; the program (can take args)
directory=%(ENV_HOME)s/app/tomcat/ ; directory to cwd to before exec (default no cwd)
autostart=true ; start application at supervisord start (default: true)
stopwaitsecs=10 ; max num secs to wait before SIGKILL (default 10)
stdout_logfile=%(ENV_HOME)s/.services/supervisord/tomcat/log/default.log
stdout_logfile_maxbytes=1MB ; filesize at which to rotate logfiles (default ist 50MB)
stdout_logfile_backups=10 ; number of stdout logfile backups (0 means none, default 10)
stderr_logfile=%(ENV_HOME)s/.services/supervisord/tomcat/log/default.err
stderr_logfile_maxbytes=1MB ; filesize at which to rotate logfiles (default is 50MB)
stderr_logfile_backups=10 ; number of stderr logfile backups (0 means none, default 10)
environment=CATALINA_HOME="%(ENV_HOME)s/app/tomcat/current",JAVA_HOME="/usr/local/openjdk8",JAVA_OPTS="-Xms128m -Xmx1024m"

JAVA_OPTS

The environment variable JAVA_OPTS, which is configured with environment=, lets you pass Java options to Tomcat. For example, -Xmx1014m sets the configuration to allocate a maximum of 1 GB RAM to Tomcat. You can modify this value to best suit your needs.

Using supervisorctl update, you can apply the new configuration to Tomcat:

supervisorctl update
tomcat: added process group

Attention: If you receive an error, you must uniquely execute before "hpservices supervisord start".

For more detailed information on working with CSC and the options it offers, refer to the guide for Custom Service Control.

Web server configuration

If you now want to make your application accessible via HTTP(S), you must configure your website in the Hostpoint Control Panel so that the web server will route requests to your application via proxy.

In your Hostpoint Control Panel, create a website of the type “Nginx proxy for own application”:

Website erstellen Port 8080 en

Server address and port
The proxy function expects that your application will be listening to the IPv4 loopback address 127.0.0.1, meaning that you only have to enter the port: 8080 (default port for Tomcat).

Additional information

 

Please use this form only to provide feedback on the above guide.
For support requests please use this form instead.

 

 

© 2001 - Hostpoint AG
Cookie

Wir verwenden Cookies  🍪

We use Cookies  🍪

Nous utilisons des cookies  🍪

Utilizziamo dei cookie  🍪

Die digitalen Auftritte von Hostpoint (Website, Control Panel, Support Center etc.) verwenden Cookies. Diese werden dazu verwendet, um Daten über Besucherinteraktionen zu sammeln. Wenn Sie auf «Akzeptieren» klicken, stimmen Sie der Verwendung dieser Cookies für Werbezwecke, Website-Analyse und Support zu. Gewisse essenzielle Cookies sind jedoch für eine ordnungsgemässe Funktion dieser Seiten unerlässlich und können deshalb nicht deaktiviert werden. Auch ohne Ihre Zustimmung können gewisse Daten in anonymisierter Form für statistische Zwecke und zur Verbesserung unserer Websites verwendet werden. Bitte beachten Sie unsere Datenschutzerklärung.

Hostpoint's digital presences (website, Control Panel, Support Center, etc.) use cookies. These are used to collect data on visitor interactions. If you click “Accept”, you agree to the use of these cookies for advertising purposes, website analysis and support. However, certain cookies are essential for the proper functioning of these pages and therefore cannot be disabled. Even without your consent, certain data may be used in anonymized form for statistical purposes and to improve our websites. Please note our Privacy policy.

Le sites Web de Hostpoint (site Web, Control Panel, Centre d'assistance, etc.) utilisent des cookies. Ces cookies servent à collecter des données sur les interactions des visiteurs. En cliquant sur «Accepter», vous consentez à l’utilisation de ces cookies à des fins de publicité, d’analyse du site Web et d’assistance. Certains cookies essentiels sont cependant indispensables au bon fonctionnement de notre sites Web et ne peuvent donc pas être désactivés. Même sans votre consentement, certaines données peuvent être utilisées sous forme anonymisée à des fins statistiques et pour améliorer notre sites Web. Veuillez prendre connaissance de notre Déclaration de protection des données.

Le presenze digitali di Hostpoint (sito web, Pannello di controllo, Support Center, ecc.) utilizzano i cookie. Questi vengono utilizzati per raccogliere dati sulle interazioni dei visitatori. Facendo clic su «Accetta», acconsente all’utilizzo di questi cookie per scopi pubblicitari, di analisi del sito web e di supporto. Alcuni cookie essenziali sono tuttavia indispensabili per il corretto funzionamento di questi siti web e pertanto non possono essere disattivati. Anche senza il Suo consenso, determinati dati potrebbero essere utilizzati in forma anonima per fini statistici e per l’ottimizzazione dei nostri siti web. Si prega di tenere conto della nostra Dichiarazione per la pivacy.

Ablehnen
Decline
Refuser
Rifiuta
Akzeptieren
Accept
Accepter
Accetta