...
Perform the following steps in order to switch from HTTP to HTTPS for Apache Tomcat:
Step - 1: Creating a keystore file
...
1. Open the command prompt and enter the following command:
Code Block |
---|
keytool -genkey -alias tomcat -keyalg RSA -keystore canvascertificate.cert |
2. Enter the keystore and key password details for generating the keystore file. Here, the keystore is saved as canvascertificate.cert
Step – 2: Configuring Apache Tomcat for using keystore file — SSL config
File Location: <Tomcat-Installed-Folder>\conf \ server.xml
...
1. Comment the following command in order to disable the default HTTP configuration:
Code Block |
---|
<Connector executor="tomcatThreadPool" |
...
port="8080" protocol="HTTP/1.1" |
...
connectionTimeout="20000" |
...
redirectPort="8443" /> |
2. Add the following command to enable the HTTPS configuration below the commented http configuration command.
Code Block |
---|
<Connector SSLEnabled="true" acceptCount="100" clientAuth="false" |
...
disableUploadTimeout="true" enableLookups="false" maxThreads="150" |
...
port="9129" keystoreFile="D:\apache-tomcat-9.0.36\conf\canvascertificate.cert" keystorePass="canvas" |
...
protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" |
...
secure="true" sslProtocol="TLS" /> |
...
Note |
---|
|
Step – 3: Accessing the Application
Start tomcat service and try to access https://localhost:9129. You will see Tomcat's local home page.