将Tomcat下的http项目迁移到https

操作概述: 

一共2步,需要配置tomcat和application.

1.配置tomcat,使其支持ssl

1.1 导出keystore文件:

keytool -v -genkey -alias tomcat -keyalg RSA -keystore /software/tomcat/tomcat.keystore
跟着提示操作就好, 密码可以用相同的

1.2 配置$TOMCAT_HOME/server.xml

启用SSL,并且设置keystorePass和keystoreFile的值
		<!-- 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 SSLEnabled="true" clientAuth="false" maxThreads="150"
			port="8443" protocol="HTTP/1.1" scheme="https" secure="true"
			sslProtocol="TLS" keystorePass="tigEr@53" 
			keystoreFile="/software/tomcat/tomcat.keystore" />


2.修改web.xml文件使其重定向

在<welcome-file-list/>后边加上一段, done.
	<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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值