Tomcat SSL 配置
来源:互联网 发布:sql文件解压后怎么安装 编辑:程序博客网 时间:2024/06/07 12:23
Using JDK 7 and Tomcat 7, similar to other versions.
Step:
1. 用Java去创建一个keystore文件,执行 keytool genkey - alias tomcat - keyalg RSA.
因此在用户主目录,创建了一个keystore文件。
C:\Users\calvin.yang>keytool -genkey -alias tomcat -keyalg RSAEnter keystore password: password Re-enter new password: passwordWhat is your first and last name?[Unknown]: calvin yangWhat is the name of your organizational unit?[Unknown]: abcWhat is the name of your organization?[Unknown]: abcWhat is the name of your City or Locality?[Unknown]: ZhuhaiWhat is the name of your State or Province?[Unknown]: GuangDongWhat is the two-letter country code for this unit?[Unknown]: CNIs CN=calvin yang, OU=abc, O=abc, L=Zhuhai, ST=GuangDong, C=CN correct?[no]: yesEnter key password for <tomcat>(RETURN if same as keystore password): passwordRe-enter new password: password
2. 配置Tomcat,使用这个keystore文件打开server.xml,找到下面的注解
<!--<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" />-->去掉注释,改变成下面的内容<Connector SSLEnabled="true" acceptCount="100" clientAuth="false" disableUploadTimeout="true" enableLookups="false" maxThreads="25" port="8443" keystoreFile="C:/Users/calvin.yang/.keystore" keystorePass="password" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS" />3. 测试开启Tomcat,访问https://localhost:8443. 你就会看见Tomcat的默认主页面了。
4.使用SSL配置应用程序, 例如:https://localhost:8443/myApp
打开web.xml,加上下面的配置:
<security-constraint> <web-resource-collection> <web-resource-name>securedapp</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint></security-constraint>设置成 /* URL映射,你的程序的所有访问都会使用HTTPS。设置transport-gurantee为CONFIDENTIAL,为了让程序支持SSL。如果你想要关掉SSL,你只要把CONFIDENTIAL变为NONE。
-------------------------------------------------------------------------------------------------
官方文档:http://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html
阅读全文
0 0
- 配置Tomcat SSL认证...
- tomcat实现SSL配置
- tomcat实现SSL配置
- Tomcat 配置SSL
- tomcat配置ssl
- tomcat SSL协议配置
- Tomcat配置SSL
- Tomcat 的 SSL配置
- 配置Tomcat使用SSL
- Tomcat配置SSL认证
- Tomcat 5.5 配置SSL
- Tomcat配置SSL
- 配置Tomcat使用SSL
- tomcat实现SSL配置!
- Tomcat配置Https (SSL)
- Tomcat SSL配置大全
- Tomcat SSL 配置
- Tomcat 6.0 SSL 配置
- Python 3从入门到精通16-常用函数
- Java--面向对象之封装
- 欢迎使用CSDN-markdown编辑器
- 用QT写了一个串口工具,run之后总是报这个,要重启电脑才可以
- -webkit-text-stroke
- Tomcat SSL 配置
- 腾讯2017社交广告比赛(广告转化率预测)总结与分享--by Coda_Allegro
- Java list.remove( )方法需要注意的两个地方
- OC语言单例模式与Swift单例模式
- 深度学习常用中英文对照表
- 动态规划问题详解
- Looking Beyond Appearances: Synthetic Training Data for Deep CNNs in Re-identification 学习笔记
- A1
- appium简明教程(2)——appium的基本概念