How to set up HTTPS on Tomcat

Apache Tomcat, often referred to as Tomcat Server, is an open-source Java Servlet Container developed by the Apache Software Foundation (ASF). Tomcat implements several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket, and provides a “pure Java” HTTP web server environment in which Java code can run.

This Tomcat Tutorial will show you how to create a self signed cert that you can then use to secure Tomcat.

Step 1

Open a command prompt window and navigate to your JAVA_HOME bin folder, in our case:

C:\Program Files\Java\jre1.8.0_171\bin

Step 2

Enter the command:

keytool -genkey -alias tomcat -keyalg RSA -keystore “C:\apache-tomcat-8.5.34\conf\localhost.jks”

Note: You should update the tomcat path to match your path 

Step 3

You will then be prompted for a series of values, in our case we entered:

enter Keystore password: password
retype keystore password: password
what is your first and last name: localhost
what is the name of your orgainsation unit: IT
what is the name of your organisation: Darren
what is the name of your city: Dublin
what is the name of your state or province: Leinster
What is the two-letter country code for this unit: IE

When prompted type yes to confirm all is correct.

Next you will be asked to use the same password for <tomcat>, press enter here:

Step 4

Now open the tomcat server.xml file, in our case the file is located here:


Step 5

Add the following block to the file:

		port="8443" maxThreads="200"
		scheme="https" secure="true" SSLEnabled="true"
		keystoreFile="conf\localhost.jks" keystorePass="password"
		clinetAuth="false" sslProtocol="TLS" />

Step 6

Restart Tomcat.

Step 7

Navigate to https://localhost:8443.

You should first see a certificate warning, click to bypass the warning.

Step 8

You should now see Tomcat working over HTTPS

A full video tutorial can be found here:

3 thoughts on “How to set up HTTPS on Tomcat

  1. Pingback: How to Set up HTTPS SSL on Tomcat | All about hosting

  2. Pingback: How to Set up HTTPS SSL on Tomcat - Hosting solutions

Leave a Reply

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