用keytool生成證書(shū):
keytool -genkey -alias tomcat -keyalg RSA -keystore c:/tomcat/mykey
說(shuō)明:
這里-alias tomcat 是表示生成的這個(gè)證書(shū)的別名叫tomcat,-keyalg RSA 指的是采用的RSA算法,-keystore c:/tomcat/mykey 是指生成的證書(shū)存儲(chǔ)的位置。回車后會(huì)提示你輸入keystore password,這可以自己定。
去掉tomcat serverv.xml里面關(guān)于SSL的注釋,修改為:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="C:\apache-tomcat-6.0.14\mykey" keystorePass="testpassword"/>
輸入https://localhost:8443/,提示安裝證書(shū)