1 Answers1

11

This answer applies to Tomcat 9 only... 7 and 8 are already well documented on the interwebs.

You can't use port 80 because ports under 1024 are restricted to root access in Linux unless you use authbind to override that restriction.

I had this same problem while using Ubuntu LTS 20.04, Tomcat 9.0.40 and here is what I had to do to fix it. I make no promises outside that specific situation.

This assumes you are using systemctl to start and stop your Tomcat server. If you're running inside a Docker Container or Hyper-V VS that is unlikely and these instruction won't exactly fit your situation, but they should be close enough to get you through. Also, I'm not going to type sudo 100 times... if you have root access great, if not prefix everything with sudo.

Install AUTHBIND

apt-get install authbind

Set-up AUTHBIND for you tomcat system user

touch /etc/authbind/byport/80
chown tomcat: /etc/authbind/byport/80
chmod 500 /etc/authbind/byport/80

Modify systemctl to use AUTHBIND when starting the tomcat

vi /etc/systemd/system/tomcat.service
change --> ExecStart=/opt/tomcat/bin/startup.sh
to     --> ExecStart=authbind --deep /opt/tomcat/bin/startup.sh

Reload the systemctl daemon to use the new settings

systemctl daemon-reload

Edit the tomcat server configuration to set port 80

vi /opt/tomcat/conf/server.xml
change --> <Connector port="8080"...
to     --> <Connector port="80"...

Restart tomcat

systemctl restart tomcat

Good luck.

pixemeck
  • 126
  • 1
  • 5