Making Tomcat accessible on port 80

306 Views Asked by At

I'm configuring Tomcat on Debian 9 for a production environment which will be running Spring web applications.

I was reading about making Tomcat accessible from port 80 and as I understand, it is not recommended to run it as root in order to change the port to 80 for security reasons.

It's also possible to use iptables make Tomcat accessible from port 80, but from what I read using that method only works for IPv4 and not IPv6.

Another way I know of is using Apache HTTPd's mod_proxy to direct the traffic from Apache to Tomcat. Would this be the best solution? IPv6 would work with this method?

What is the industry standard to make Tomcat available on port 80?

1

There are 1 best solutions below

3
eDog On BEST ANSWER

Lots of questions in one ask, so lets answer your question directly, then the rest.

In the tomcat configuration files, there is a configuration file called server.xml. There you can specify the default port tomcat will listen on. Its on a connector node and defaults to 8080. Find it and change it to 80. Save the file, reload tomcat and your service is now listening on port 80.

For the other questions, you want to traditionally proxy access to your tomcat server. You can use any webserver to catch traffic frpm port 80 and forward requests for the the application server to tomcat. Depending on the webserver they have different ways to act like a proxy. Using a http server for a.proxy is normally used if you are going to offload static content on the webserver then the dynamic content or that needed the servlet container ober to the tomcat server. If you plan to send everything ovwr, remove the middle man and just let tomcat sever respond to all 5he web traffic by changing the default port it listens on.