Tomcat 配置https
2010-06-09 21:49
239 查看
<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-constrain
1、执行命令生成一个服务器端的key
D:/Java/jdk1.6.0_17/bin>keytool -genkey -alias tomcat -keyalg RSA
-keypass changeit -storepass changeit -keystore C:/server.keystore
-validity 3600
2、把tomcat中conf目录下的server.xml中的8443的Connector 改为如下:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
keystoreFile="conf/server.keystore" keystorePass="changeit"
clientAuth="false" sslProtocol="TLS"
URIEncoding="UTF-8" />
注:完成以上两步,该tomcat就已经支持https方式的访问了
3、中web应用的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>
这个配置将强制给web应用只能通过https方式访问,当用HTTP进行访问时将自动的转成https方式
相关文章推荐
- tomcat配置https协议详细步骤
- https原理及tomcat配置https方法
- Tomcat配置https访问
- Tomcat配置SSL连接 和 ksoap-2-android-with-https
- https原理及tomcat配置https方法
- tomcat7+jdk的keytool生成证书 配置https
- centos7 nginx+tomcat配置https 安装免费SSL Let’s Encrypt
- tomcat配置https 和 http强制跳转https
- 详解 Nginx + Tomcat HTTPS/SSL 配置方法
- https原理及tomcat配置https方法
- Nginx+Tomcat服务器环境中配置https访问
- SSL-HTTPS与Java-Tomcat配置
- HTTPS协议在Tomcat中启用是如何配置的
- TOMCAT配置SSL认证为HTTPS协议服务
- tomcat同时使用http和https访问的配置方法
- nginx tomcat https 配置
- https开发——tomcat配置
- Tomcat配置Https
- Tomcat 配置成https协议
- tomcat配置https