Steps to configure SSL (Secure Socket Layer) in Apache Tomcat 9.0
Generate a Keystore File:
Run the following command to generate a keystore file:
keytool -genkey -alias tomcat -keyalg RSA -keystore
Or
keytool -genkeypair -alias “abc.keystore” -keyalg RSA -keysize 2048 -dname “EMAILADDRESS= , CN=, O= , L= , ST=, C= ” -ext san=dns:”server” -validity 365 -keypass “pass123” -keystore “abc.keystore” -storepass “changeit” -storetype JKS
keytool -importcert -noprompt -alias “abc.keystore” -file “.p7b” -keystore “abc.keystore” -storepass “pass123”
Update Tomcat’s Configuration:
Open the server.xml file located in the /conf directory.
Locate the element that corresponds to the HTTP port (usually 8080) and add a new element for the HTTPS port (e.g., 8443) with the following attributes
clientAuth=”false” sslProtocol=”TLS”/>
Save the changes to server.xml and restart Tomcat for the configuration to take effect