一. 安装好tomcat,在localhost:8080下能正常的访问
二. 生成keystore证书
生成keystore证书
keytool -genkey -alias zhuzhiqiang -keyalg RSA -keystore /Users/anyware/Documents/mine/key/tomcat/zhuzhiqiangkey 说明: keytool -genkey -alias "别名" -keyalg RSA -keystore "存储位置"
如图:
修改host文件的参考地址是: http://blog.csdn.net/zhuzhiqiang_zhu/article/details/70211743 注意:其中您的名字与姓氏不要写你自己的名字
- 导出crt证书
命令为:
keytool -export -file zhuzhiqiang2.crt -alias zhuzhiqiang -keystore zhuzhiqiangkey2
说明:
keytool -export -file "filename.crt文件地址" -alias "别名(第一步设置的)" -keystore "上一步生成的keystore地址"
如图:
向JVM导入证书
-import -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/security/cacerts -file zhuzhiqiang2.crt 说明: keytool -import -keystore "本机cacerts文件地址" -file "你的crt文件地址"
如图:
博客地址: http://blog.csdn.net/zhuzhiqiang_zhu/article/details/70212499
三. 设置server.xml
- 使用编辑器打开server.xml
server.xml的文件地址是:
如图:
<Connector port="8999" protocol="org.apache.coyote.http11.Http11NioProtocol" maxThreads="150" SSLEnabled="true" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="/Users/anyware/Documents/mine/key/tomcat/zhuzhiqiangkey" keystorePass="123456" />
四、运行
启动tomcat `startup.sh`
在地址栏输入`localhost:8443`