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.

    
    
  • 相关阅读:
    AngularJS指令的详解
    Linux(Ubuntu)下如何安装JDK
    Hibernate的三种状态
    JS是按值传递还是按引用传递
    git分支管理
    Hibernate注解映射联合主键的三种主要方式
    Linux下解决用户不能执行sudo的方法
    【GStreamer开发】GStreamer基础教程03——动态pipeline
    【GStreamer开发】GStreamer基础教程02——GStreamer概念
    【GStreamer开发】GStreamer基础教程02——GStreamer概念
  • 原文地址:https://www.cnblogs.com/greys/p/10881161.html
Copyright © 2011-2022 走看看