Tomcat 配置SSL
今天闲来无事,以前没有弄过SSL,准备试试。
1、也在网上搜了怎么使用的,首先用JAVA自带的KEYTOOLS 生成密钥
windows用户:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
<!-- Define a SSL HTTP/1.1 Connector on port 8443 This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation -->
<Connector className="org.apache.coyote.tomcat6.CoyoteConnector" port="8443" minProcessors="5" maxProcessors="75" enableLookups="true" acceptCount="100" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="生成密钥的路径" keystorePass="你设置密钥的密码" />
https://localhost:8443,如能正确显示,则表示SSL配置成功。
<security-constraint> <web-resource-collection> <web-resource-name>Restricted URLs</web-resource-name> <url-pattern>/</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint></security-constraint>