首先是在命令行下,进入到Java的安装目录,执行命令创建证书:
%JAVA_HOME%/bin/keytool -genkey -alias tomcat -keyalg RSA -keystore D:/server.keystore -validity 365
然后,程序会提示输入一些信息。注意密码尽量填写为changeit,并且要将%TOMCAT_HOME%/conf/tomcat-users.xml文件中用户的密码改为changeit。
然后到%TOMCAT_HOME%/conf/server.xml文件中添加如下内容:
<
Connector
className
="org.apache.coyote.tomcat6.CoyoteConnector"
port ="8443" minProcessors ="5"
maxProcessors ="75" enableLookups ="true"
acceptCount ="100"
protocol ="HTTP/1.1" SSLEnabled ="true"
maxThreads ="150" scheme ="https" secure ="true"
clientAuth ="false" sslProtocol ="TLS"
keystoreFile ="D:/server.keystore"
keystorePass ="changeit" />
port ="8443" minProcessors ="5"
maxProcessors ="75" enableLookups ="true"
acceptCount ="100"
protocol ="HTTP/1.1" SSLEnabled ="true"
maxThreads ="150" scheme ="https" secure ="true"
clientAuth ="false" sslProtocol ="TLS"
keystoreFile ="D:/server.keystore"
keystorePass ="changeit" />