.1 確認存放keystore文件的位置(好比:D:\Tomcat\GMAE3.0Tomcat) .2 在cmd中進入%JAVA_HOME%\bin目錄下,執行如下命令: keytool -genkey -alias tomcat -keyalg RSA -keystore d:\Tomcat\GMAE3.0Tomcat\tomcat.keystore 執行過程會提示輸入密碼,這個密碼須要記錄在server.xml中的Connector中,第3步有說明 .3 修改tomcat中文件conf/server.xml <Connector port="8060" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8063" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="D:\Tomcat\GMAE3.0Tomcat\tomcat.keystore" keystorePass="123456"/> .4 在tomcat\conf\web.xml中的</welcome-file-list>後面加上這樣一段: <login-config> <!-- Authorization setting for SSL --> <auth-method>CLIENT-CERT</auth-method> <realm-name>Client Cert Users-only Area</realm-name> </login-config> <security-constraint> <!-- Authorization setting for SSL --> <web-resource-collection > <web-resource-name >SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>