EN
Tomcat 8 - https / SSL / TSL configuration for development on localhost
5 points
In this article we would like to show how to enable https in Tomcat 8 Server and use it for development on development.
- go to Tomcat configuration directory,
e.g. in Windows it can be:C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.46\conf
e.g. inDebian Linux
it can be:/var/lib/tomcat8/conf
- open
server.xml
,
- confugure following listener:
xxxxxxxxxx
1<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
Listener
element should be nested directly insideServer
element at begining of config file.
- find and edit or create new one
Connector
element that hasscheme="https"
attribute, e.g.:xxxxxxxxxx
1<Connector
2protocol="org.apache.coyote.http11.Http11NioProtocol"
3port="8443" maxThreads="200"
4scheme="https" secure="true" SSLEnabled="true"
5keystoreFile="${user.home}/.keystore" keystorePass="my_secret_password"
6clientAuth="false" sslProtocol="TLS"/>
Connector
element should be nested inServer
->Service
->Connector
andkeystorePass
attribute should be set to own one password.Note: official documentation can be found here.
- go to home directory and execute following command:
xxxxxxxxxx
1"C:\Program Files\Java\jdk1.8.0_202\bin\keytool" -genkey -keystore ".keystore" -alias tomcat -keyalg RSA
Notes:
Console output:
- use same password like inConnector
element,
- example home directory:~/my_user_name
for Linux/Unix orC:\Users\my_user_name
for Windows ~10.xxxxxxxxxx
1john@DESKTOP-PC MINGW64 ~
2$ "C:\Program Files\Java\jdk1.8.0_202\bin\keytool" -genkey -keystore ".keystore" -alias tomcat -keyalg RSA
3Enter keystore password: my_secret_password
4Re-enter new password: my_secret_password
5What is your first and last name?
6[Unknown]: John Dee
7What is the name of your organizational unit?
8[Unknown]: Lack
9What is the name of your organization?
10[Unknown]: Lack
11What is the name of your City or Locality?
12[Unknown]: Heaven
13What is the name of your State or Province?
14[Unknown]: Lack
15What is the two-letter country code for this unit?
16[Unknown]: UK
17Is CN=John Dee, OU=Lack, O=Lack, L=Heaven, ST=Lack, C=UK correct?
18[no]: yes
19
20Enter key password for <tomcat>
21(RETURN if same as keystore password):
22
23john@DESKTOP-PC MINGW64 ~
24$
Note: official documentation can be found here.
- run yours server,
- open in web browser following link:
https://localhost:8443/
,
- in web browser confirm proceding to unsafe page.




