zoukankan      html  css  js  c++  java
  • tomcat下配置http和https

     以下配置文件中配置了多个connector,采用https443和http80端口。8009是AJP的端口,如果没有用到jsp,可以将这个注释。

    <?xml version='1.0' encoding='utf-8'?>
    <Server port="8008" shutdown="SHUTDOWN">
      <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
      
      <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
      <!-- Prevent memory leaks due to use of particular java/javax APIs-->
      <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
      <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
    
      <!-- Global JNDI resources
           Documentation at /docs/jndi-resources-howto.html
      -->
      <GlobalNamingResources>
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved"
                  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
                  pathname="conf/tomcat-users.xml" />
      </GlobalNamingResources>
    
      <Service name="Catalina">
    
        <!--The connectors can use a shared executor, you can define one or more named thread pools-->
        <Executor name="tomcatThreadPool" namePrefix="catalina-exec-"  maxThreads="150" minSpareThreads="4"/>
        
        <Connector port="80" protocol="HTTP/1.1"  connectionTimeout="20000"  redirectPort="443" minProcessors="5" maxProcessors="75" executor="tomcatThreadPool"/>
        
        <Connector port="8009" enableLookups="false" protocol="AJP/1.3" redirectPort="443"  minProcessors="5" maxProcessors="75" executor="tomcatThreadPool"/>
        
        <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" scheme="https" secure="true"  minProcessors="5" maxProcessors="75" 
         clientAuth="false" sslProtocol="TLS" keystoreFile="cert/2216814_https.xxxxxx.com.pfx" keystorePass="Fa5oLIfT" executor="tomcatThreadPool"/>
       
        <Engine name="Catalina" defaultHost="localhost">
    
          <Realm className="org.apache.catalina.realm.LockOutRealm">
            <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
          </Realm>
    
          <Host name="localhost"  appBase="webapps" unpackWARs="true" autoDeploy="true">
          </Host>
        </Engine>
      </Service>
    </Server>
    注:
      上述autoDeploy="true" 可以改为false;
       tomcatThreadPool可以不配,建议配上,用线程池管理以省去线程创建和销毁的时间

    web.xml

    以上配置都是tomcat/conf下的文件 server.xml以及web.xml.

    
    
  • 相关阅读:
    【bzoj2821】作诗(Poetize)
    ZOJ-2112-Dynamic Rankings(线段树套splay树)
    POJ- 2104 hdu 2665 (区间第k小 可持久化线段树)
    hust-1024-dance party(最大流--枚举,可行流判断)
    hdu-3046-Pleasant sheep and big big wolf(最大流最小割)
    POJ-3294-Life Forms(后缀数组-不小于 k 个字符串中的最长子串)
    POJ-Common Substrings(后缀数组-长度不小于 k 的公共子串的个数)
    POJ-2774-Long Long Message(后缀数组-最长公共子串)
    POJ-3693-Maximum repetition substring(后缀数组-重复次数最多的连续重复子串)
    spoj-694-Distinct Substrings(后缀数组)
  • 原文地址:https://www.cnblogs.com/greys/p/10881161.html
Copyright © 2011-2022 走看看