0%

把Tomcat的http改为https的步骤方法

生成证书

1
keytool -genkey -alias tomcat -keyalg RSA -keystore D:\\a.keystore

按步骤输入相关信息

修改tomcat相关配置

conf/server.xml
1
2
3
4
5
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true"  
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="D:\a.keystore"
keystorePass="123456" />
conf/web.xml
1
2
3
4
5
6
7
8
9
<security-constraint>    
<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>