How to run Ubuntu Tomcat in Port 80 HTTPS & install SSL for Tomcat

First you need to run below commands:
 
  sudo touch /etc/authbind/byport/80
  sudo chmod 500 /etc/authbind/byport/80
  sudo chown tomcat8 /etc/authbind/byport/80

 

Then you need to add AUTHBIND=yes in /etc/default/tomcat8
 
Here you can change the JAVA_HOME & JAVA_OPTS:


JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 
JAVA_OPTS="-Djava.awt.headless=true -XX:+UseConcMarkSweepGC -Xms512m -Xmx4G -XX:PermSize=512M -Dorg.owasp.esapi.resources=/var/lib/tomcat8/webapps/ROOT/WEB-INF/classes/ESAPI.properties"
AUTHBIND=yes

 

Then you need to change Tomcat port in server.xml  :

 
vim /var/lib/tomcat8/conf/server.xml


<!--was 8080 -->
<Connector port="80" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />

 

And convert your SSL certificate to pfx format and add to keystoreFile section in the server.xml file. You also need to add your private keystorePass as well:
 


<Connector
protocol="org.apache.coyote.http11.Http11NioProtocol"
port="443"
maxThreads="200"
scheme="https"
secure="true"
SSLEnabled="true"
keystoreFile="/PATH-To-Your-pfx-file.pfx"
keystorePass="YOUR KEY STORE PASS"
keystoreType="PKCS12"
clientAuth="false"
sslProtocol="TLS"/>

 
Then you need to restart tomcat :
 
sudo service tomcat8 restart

 

Leave a Reply

Your email address will not be published. Required fields are marked *