且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

tomcat http https

更新时间:2022-09-17 08:54:07

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

Xml代码  tomcat http https
  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:
   

Xml代码  tomcat http 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