mac下搭建https服务器

1.安装好tomacat后,输入  http://localhost:8080 .

https呢,需要道 tomcat/conf/server.xml增加

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="/Users/menchao/myCert/server.keystore" keystorePass="123456"/>

2.在java web中开启https ,在web.xml中添加:

<security-constraint>

    <web-resource-collection>

        <web-resource-name>securedapp</web-resource-name>

        <url-pattern>/*</url-pattern>

    </web-resource-collection>

    <user-data-constraint>

        <transport-guarantee>CONFIDENTIAL</transport-guarantee>

    </user-data-constraint>

</security-constraint>

 

 

原文地址:https://www.cnblogs.com/menchao/p/4953912.html