How to Install Apache Tomcat Server on Debian 11. In this article we will introduce what Tomcat is with its features and move onto installation steps with configuring Nginx as a reverse proxy for Tomcat. Let’s start.
What is Apache Tomcat
Apache Tomcat is an open source web server with the Servlet container used for deploying Java based web applications. Tomcat server comes with Java Servlet, Java EL and JavaServer Pages that help you to run Java code via web browser. It is a cross platform, so it can be installed and run on Linux and Windows operating systems. It is one of the most widely used Java servers due to its good extensibility, proven core engine and well tested and durable. Tomcat allows developers to write and host Java based dynamic applications on the web. If you are looking to host applications that process thousands of requests then Tomcat is the best option for you.
In simple words, we can say that the Apache Tomcat is actually a server and servlet container to create dynamic websites. Both the server and servlet container combine to form a single server which is popularly known as the “Apache Tomcat”.
In the next part of How to Install Apache Tomcat Server on Debian 11, by default Tomcat can be accessed without any user or password. For security reasons, it is a good idea to enable authentication in Tomcat. You can do it by editing the Tomcat configuration file:
nano /opt/tomcat/conf/tomcat-users.xml
Add the following lines above the line </tomcat-users>:
rolename="admin-gui,manager-gui"/>
Save and close the file when you are done.
Also, Tomcat manager app and host manager app is accessed only from the localhost. So you will need to configure Tomcat so it can be accessed from the remote system.
Save and close the file then verify the Nginx for any syntax configuration error:
nginx -t
If everything is fine, you will get the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Next, restart the Nginx service to apply the configuration changes:
systemctl restart nginx
You can also check the Nginx status using the following command:
systemctl status nginx
You should see the following output:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-04-06 11:58:13 UTC; 59s ago
Docs: man:nginx(8)
Process: 40436 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 40437 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 40520 (nginx)
Tasks: 3 (limit: 4679)
Memory: 3.2M
CPU: 56ms
CGroup: /system.slice/nginx.service
├─40520 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
├─40522 nginx: worker process
└─40523 nginx: worker process
Apr 06 11:58:13 debian11 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 06 11:58:13 debian11 systemd[1]: Started A high performance web server and a reverse proxy server.
How to Install Apache Tomcat Server on Debian 11 Conclusion
In this article we explained steps how to install Apache Tomcat Server on Debian 11. We also explained configuring Nginx as a reverse proxy for Tomcat. You can now create and deploy Java based dynamic application on the Tomcat server.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.