×

Run Tomcat on 80 Using Authbind in GCP

The article would walk you through simple and detail steps for configuring authbind to switch ports listened by tomcat server in ubuntu 16.02.

Run Tomcat on 80 Using Authbind in GCP

What is Apache Tomcat?


Apache Tomcat is an application server by which you can deploy your code. Apache Tomcat is an open-source Java Servlet Container and its run on 8080 port by default.


What is authbind?


The authbind is an Open source system which allows a program that would normally require superuser privileges to access privileged network services to run as a non-privileged user. It allows the system administrator to permit specific users and groups access to bind to TCP and UDP ports below 1024.


Steps need to follow


1.Create an instance on GCP



2. Update the package repository

  • sudo -i

  • sudo apt-get update



3. Install the authbind package

  • apt-get install authbind



4. Install the tomcat7 package

  • apt-get install tomcat7



The tomcat7-docs, tomcat7-examples,and tomcat7-admin packages aren’t required to deploy and maintain a web application. These packages can be skipped unless they are truly needed.


A new user “tomcat7” with primary group “tomcat7” will be created.


5. Enable authbind


  • nano /etc/default/tomcat7


Remove the comment hash “#” in front of the authbind property and set the value to ‘yes’.


AUTHBIND=yes



6. Create authbind bind permission files


  • touch /etc/authbind/byport/80

  • touch /etc/authbind/byport/443

  • chmod 0755 /etc/authbind/byport/80

  • chmod 0755 /etc/authbind/byport/443

  • chown tomcat7:tomcat7 /etc/authbind/byport/80

  • chown tomcat7:tomcat7 /etc/authbind/byport/443


7. Change the Tomcat Port from 8080/8443 to 80/443


  • nano /etc/tomcat7/server.xml


Find the connector for port 8080 to port 80 and the redirect port from 8443 to 443:



8. Restart the Tomcat service


  • service tomcat7 restart


9. Click on

 





Trendy