Deploying a Tomcat Application Using Podman on a cPanel Server
If you are looking to simplify the installation process and while maintaining flexibility and control over tomcat applications, then installing tomcat applications using podman on cPanel server is the ideal choice. This approach is very efficient to combine containerization with user-friendly management features of cPanel and is suitable for developers and administrators.
Installation Process
Step 1: Install Tomcat Using Podman
Open the Terminal from cPanel to create a new Tomcat application by running the following command:
/scripts/ea-podman install ea-tomcat101
This command will install the Tomcat and create a directory named
ea-tomcat101.username.02 within /ea-podman.d/ directory.
Step 2: Upload the WAR File
Go the newly created Tomcat directory:
cd /home/username/ea-podman.d/ea-tomcat101.username.02
Locate the webapps folder and upload your .war file in this directory. Make sure the file is named ROOT.war to ensure it’s deployed correctly.
Step 3: Modify Tomcat Configuration
To make sure the application is installed on startup, go to the conf file
cd /home/username/ea-podman.d/ea-tomcat101.username.02/conf
open server.xml file to make changes and Check the below lines:
<Host name=”localhost” appBase=”webapps” unpackWARs=”false” autoDeploy=”false” deployOnStartup=”false” deployXML=”false”>
Change the false values to true. It should look like this after the changes:
<Host name=”localhost” appBase=”webapps” unpackWARs=”true” autoDeploy=”true” deployOnStartup=”true” deployXML=”true”>
After making the changes, save and close the file.
Step 4: Restart Tomcat
To implement the changes, restart Tomcat service by executing the following command:
/scripts/ea-podman restart ea-tomcat101.username.02
Once the Tomcat service is restarted, the .war file will automatically install into the webapps folder and a directory named ROOT will be created for the application.
Step 5: Configure the Apache
Log into the server through SSH as the root user and make changes to the Apache configuration file located at /usr/local/apache/conf/httpd.conf. Search for the domain example.com and uncomment the following lines in the virtual host entries for ports 81 and 444:
Include "/etc/apache2/conf.d/userdata/std/2_4/username/example.com/*.conf" Include "/etc/apache2/conf.d/userdata/ssl/2_4/username/example.com/*.conf"
After the changes, save the file.
Step 6: Create Required Directories
Create the below directories as a root user:
mkdir -p /etc/apache2/conf.d/userdata/std/2_4/username/example.com mkdir -p /etc/apache2/conf.d/userdata/ssl/2_4/username/example.com
Step 7: Add a Proxy Configuration
Create a file named proxy.conf in the newly created directories, and add the below code:
<IfModule proxy_ajp_module> ProxyPass "/" "ajp://127.0.0.1:10003/" </IfModule>
To confirm the correct port, run the following command:
podman ps
Step 8: Restart Apache
Finally, restart the Apache to add all the changes by running:
systemctl restart httpd
Tomcat application is successfully installed and will be accessible on your cPanel server.
Improve Hosting Experience with Cantech’s cPanel VPS Hosting
Cantech cPanel VPS Hosting provides full control on multiple sites through an user friendly and intuitive interface. Enjoy high speed 1 gbps connectivity with improved security and storage powered by KVM technology for maximum performance.
Contact us today and get maximum experience!