Tomcat开启https配置
in with 0 comment

Tomcat开启https配置

in with 0 comment

1. 编辑tomcat/conf/server.xml

<Connector port="8443" 
    maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    enableLookups="false" disableUploadTimeout="true"
    acceptCount="100" debug="0" scheme="https" secure="true"
    keystoreFile="ssl/server.keystore" keystorePass="123456"
    clientAuth="false" sslProtocol="TLS" />

2. 编辑tomcat/webapps/hoffic/WEB-INF/web.xml

<security-constraint> 
    <web-resource-collection> 
        <web-resource-name>SSL</web-resource-name> 
        <url-pattern>/services/*</url-pattern><!-- 全站使用SSL <url-pattern>/*</url-pattern>--> 
    </web-resource-collection> 
    <user-data-constraint> 
        <description>SSL required</description> 
        <!-- CONFIDENTIAL: 要保证服务器和客户端之间传输的数据不能够被修改,且不能被第三方查看到 --> 
        <!-- INTEGRAL: 要保证服务器和client之间传输的数据不能够被修改 --> 
        <!-- NONE: 指示容器必须能够在任一的连接上提供数据。(即用HTTP或HTTPS,由客户端来决定)--> 
        <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
    </user-data-constraint> 
</security-constraint>