0

I am trying to deploy a webapp written in Java 11 ( only Servlets, no framework used).

I want to use Tomcat 10 on Ubuntu 20.04 and deploy the appp on port 80.

I installed Java 11, Tomcat 10, and MySQL.

Tomcat is installed using a user dedicated to it. I read that it is a good practice for security purposes. People argued that it is dangereous to use the Root user to deploy Tomcat.

So, I succeeded to deploy it on the default port 8080. To Access the app, I need to type: www.domain.com:8080/my_app_name.

The problem is that I want it to be accessed on port 80.

That is because users will find it very strange to access the app on www.domain.com:8080/My_app_name

If i change the port number in the file server.xml, it does not work. It is because the port 80 is a privileged port on linux, and I am running the app using a non-root user.

I read some articles about it and the possibilities are the following :

  • using iptables and redirecting requests arriving on the port 80 to the port 8080.

  • using a proxy server such as Apache or Nginx and running Tomcat behind it. In that case, the logic is that Apache is easily accessed on port 80 and it Can communicate with Tomcat on port 8080 using a connector.

  • running Tomcat as Root user on the port 80 (which is a privileged port) and change the server.xml file. Not a good idea for security.

  • using Windows server instead of linux since I was informed it does not have privileged ports.

I think that those solutions are too much bizare.

Is there not something simpler ?

If not, why is there not a webserver easy to use for Java as Apache is easy to use for PHP on linux ?

Your help is welcome.

Best, Professor wawou.

  • 1
    Running a regular web server as a proxy on port 80 and using a connector to communicate with Tomcat (or any other Java/JakartaEE application server for that matter) is in my opinion by far the most widely used solution. – Robby Cornelissen Jun 01 '21 at 08:08
  • As far as the comparison with PHP goes: it shouldn't be a lot harder to set up Apache with mod_jk and Tomcat, than Apache with mod_php and PHP. – Robby Cornelissen Jun 01 '21 at 08:18

0 Answers0