tomcat http https

时间:2021-01-22 15:45:51

Tomcat如何既支持http又支持https?在server.xml中开启两个connector:
http:

  1. <Connector port="8080" maxHttpHeaderSize="8192"
  2. maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  3. enableLookups="false" redirectPort="8443" acceptCount="100"
  4. connectionTimeout="20000" disableUploadTimeout="true"/>

https:

  1. <Connector port="8081" maxHttpHeaderSize="8192"
  2. maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  3. enableLookups="false" disableUploadTimeout="true"
  4. acceptCount="100" scheme="https" secure="true"
  5. clientAuth="false" sslProtocol="TLS" keystorePass="123456" keystoreFile="d:/tomcat.keystore"/>

端口要求不一样。即http链接使用8080,https链接使用8081。

tomcat http https