tomcat https settings

keytool -genkey -keystore "D:\localhost.keystore" -alias localhost -keyalg RSA
在D盘生成localhost.keystore文件


tomcat server.xml添加
<Connector port="9999" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"  maxThreads="150" scheme="https" secure="true"
    clientAuth="false" sslProtocol="TLS"   keystoreFile="E:\localhost.keystore"  keystorePass="123456789"/>


将原来的http,ajp的redirectPort设定成9999


在tomcat的web.xml添加
 
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </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>

实现自动跳转

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326840645&siteId=291194637