Tomcat Server
Apache Tomcat, a leading platform for running Java web applications, is like a high-performance server for computer programs. Because it’s so popular, we’ve created a guide to managing Tomcat that covers everything from setting it up (installation) to keeping it secure (security), with essential steps in between like configuration, balancing workloads (load balancing), and deploying new applications (application deployment).
This template is designed for use with a modern systemd initialization daemon.
Create Tomcat Server
Setting up Tomcat on the Platform-as-a-Service (PaaS) is straightforward:
1. Log in to your AccuWeb.Cloud PaaS dashboard on your selected hosting service provider’s website and navigate to the “New Environment” section.
2. Choose the Tomcat version that best suits your application server needs. Whether it’s Apache Tomcat 7 or the latest Tomcat 11, the cloud platform offers a range of options to accommodate your requirements. Simply select your preferred version from the dropdown menu:
Once the environment is set up, your Tomcat application server is installed and ready to use. To verify if Tomcat is running, simply click the “Open in Browser” button next to the application server.
If you can see the welcome page of Tomcat in your browser, it indicates that the server has been installed correctly.
The application server operates within its own container, which is essentially an isolated virtualized instance. Each Tomcat container is assigned its own private IP address and has a unique DNS record associated with it.
Change Tomcat Version
If you ever need to update the version of your server, you can do so at any time without worrying about losing your data or configurations.
Click the “Redeploy Containers” button next to the Apache Tomcat server nodes.
Then, select the new versions for both Tomcat and JDK engines in the dialog that appears, and confirm the change.
Tomcat Clustering and Scaling
The platform offers truly flexible Tomcat hosting thanks to automatic scaling capabilities (both vertical and horizontal) and clustering.
If you need to manually adjust your existing Tomcat server(s), simply click on “Change Environment Topology“.
Automatic Vertical Scaling
The platform enables automatic vertical scaling by dynamically adjusting allocated resources (RAM and CPU) for a server based on the current demands of the Tomcat server. This ensures efficient resource utilization, prevents overpaying for unused resources, and eliminates the need for manual adjustments.
To set up automatic resource provisioning for your Tomcat server, access the environment topology wizard and specify the upper scaling limit in cloudlets (128 MiB and 400 MHz each).
Your application will operate within these specified limits, with resource allocation adjusting accordingly based on the fluctuating load. This means resources will be reduced during low activity periods and increased during peak times, ensuring you only pay for the resources that are actually consumed. For further details, please consult the documentation on automatic vertical scaling.
Manual Horizontal Scaling
To adjust the number of Tomcat nodes, navigate to the dedicated Horizontal Scaling section in the topology wizard. You can use the +/- buttons or manually input the desired number in the central part. Additionally, click on the gear icon next to the slider to access advanced management options.
Depending on your requirements, you can choose one of two scaling modes for the layer:
- Stateless: This mode simultaneously creates all new nodes from the base image template.
- Stateful: In this mode, the file system of the master container is sequentially copied into the new nodes.
The maximum number of servers of the same type within a single environment layer is typically determined by the settings of the hosting provider, usually capped at 16 nodes. However, this limit can be adjusted by contacting support. You can verify the exact limit under the Quotas & Pricing > Account Limits information frame.
When scaling out a single node, NGINX load balancing is automatically added. You also have the option to manually switch to another load balancer. The Load Balancer acts as a frontend that receives all incoming requests and evenly distributes them between the backend application servers.
For further details on manual horizontal scaling, please refer to the documentation.
Automatic Horizontal Scaling
Automatic horizontal scaling is made possible through configurable triggers that monitor changes in the application’s load and adjust the number of nodes accordingly.
To set up a trigger for automatic horizontal scaling, follow these steps:
1. Navigate to the Settings button for the desired environment and switch to the Auto Horizontal Scaling section.
2. Click the Add button to configure triggers for a specific layer and resource type (CPU, RAM, Network, Disk) within your environment.
3. Specify the necessary scaling conditions and then click Apply changes.
Automatic Tomcat Clustering
The platform offers the convenience of automatically configuring a reliable Tomcat Cluster with the following topology in just a single click.
To enable the Auto-Clustering option, simply access the dashboard and follow the steps depicted in the image below:
Deploy Application to Tomcat Environment
Deploying an application on the platform offers various options, but the simplest method is through the Deployment Manager.
1. Access the Deployment Manager located at the bottom of the dashboard and click the Upload button in the Archive tab.
2. Select your project archive from your local files or provide a URL. Common Java archives typically have extensions like WAR, EAR, or ZIP.
3. Once uploaded, hover over the desired package in the list and click the Deploy to button.
4. Choose the appropriate environment, specify a context name (or use the default ROOT value), and begin deploying the application.
5. Once the deployment process is complete, you can find your project within the deployments of the selected environment.
There are additional deployment options available for deploying your application to Tomcat, such as via Git/SVN using Maven build node. For more detailed information, please refer to the Deployment Guide.
Tomcat Configurations
In this chapter, we’ll explore various settings and features to optimize your experience with the Tomcat web server.
Environment Variables
Enhance the portability and flexibility of your applications by leveraging environment variables instead of repeatedly specifying values in your code. The platform offers numerous default Tomcat environment variables for common stack data. You also have the option to add custom environment variables to your Tomcat node for more convenient management.
Configuration Files
Easily access and edit Tomcat configuration files directly from the dashboard. Just click on the Config button next to the server to get started.
The most commonly used directories are conveniently added to the Favorites list for quick and easy access.
Tomcat Security Settings
Securing your Tomcat projects is similar to safeguarding your home. We recommend two methods: implementing user authentication to control who can access your application via login credentials, and using deny access by IP address to block specific IP addresses from connecting.
Furthermore, the Container Firewall acts as a security barrier for your server, allowing you to manage access using both user authentication and IP filtering. You can configure the Container Firewall using the information in our “Container Firewall Management” article.
Multiple Domains on a Single Tomcat Server
Just like managing multiple email addresses at a single home address, you can configure your Tomcat server for multi-domain hosting. This allows your server to handle requests for several domain names, improving usability, efficiency, and scalability for your applications. It also saves costs compared to running separate Tomcat instances for each domain. To achieve this, you’ll need to modify the Tomcat configuration files. Specific instructions can be found in our “Multiple Domains” guide.
This highlights the platform’s strength: it makes Tomcat hosting user-friendly and adaptable. The cloud platform offers a variety of pre-configured settings to streamline routine tasks, but also allows full customization for complex configurations with multi-domain hosting. Experience effortless Tomcat cloud hosting with our Platform-as-a-Service (PaaS) solution and unlock the benefits of a comprehensive package.





















