<strong>生成安全证书:</strong>
1.java环境:因为SUN公司提供了制作证书的工具keytool。
在JDK 1.4以后的版本中都包含了这一工具,它的位置为<JAVA_HOME>\bin\keytool.exe。
2.创建证书的命令:
keytool -genkeypair -alias "tomcat" -keyalg "RSA" -keystore "D:\my\keystore\tomcat.keystore" <span style="color: rgb(68, 68, 68); font-family: tahoma, arial, sans-serif; line-height: 18px;">-validity 36500</span>
备注:前提是必须将java环境配置好
备注:姓氏输入的以后要访问的域名!!!
以上命令将生产一对非对称密钥和自我签名的证书 .D:\my\keystore\tomcat.keystore
将证书保存到你要存放的地方,我的保存在D:\soft\devTool\apache-tomcat-7.0.57\keystore\tomcat.keystore
接下来就要对tomcat的配置文件进行修改:
1.找到tomcat安装或者解压目录
2.打开到conf文件夹
3.打开server.xml文件,找到注释的内容
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
4.去掉注释,将内容修改为:
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
修改完成后,启动tomcat
在浏览器中输入:localhost:8080浏览器将自动跳转到https://localhost:8443
输入完成后点击enter,浏览器自动跳转
点击继续浏览此网站,打开tomcat首页
the end