生成 keystore 文件,默认路径为 home/.keystore。
配置 tomcat(conf/server.xml):
$ keytool -genkey -alias <tomcat admin name> -keyalg RSA
Enter keystore password: <tomcat admin password>
Re-enter new password: <tomcat admin password>
What is your first and last name?
[Unknown]: <Enter>
What is the name of your organizational unit?
[Unknown]: <Enter>
What is the name of your organization?
[Unknown]: <Enter>
What is the name of your City or Locality?
[Unknown]: <Enter>
What is the name of your State or Province?
[Unknown]: <Enter>
What is the two-letter country code for this unit?
[Unknown]: <Enter>
Is CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown correct?
[no]: yes
Enter key password for <root>
(RETURN if same as keystore password): <Enter>
配置 tomcat(conf/server.xml):
<!-- 不配置 keystoreFile 属性,用默认路径的 keystore 文件 -->
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystorePass="<tomcat admin password>"/>