主頁(yè) > 知識(shí)庫(kù) > tomcat同時(shí)使用http和https訪問(wèn)的配置方法

tomcat同時(shí)使用http和https訪問(wèn)的配置方法

熱門(mén)標(biāo)簽:電銷(xiāo)機(jī)器人怎么接線路 撫順地圖標(biāo)注 新余高德地圖標(biāo)注怎么修改 電銷(xiāo)機(jī)器人價(jià)值 高德地圖標(biāo)注好做嗎 如何分析地圖標(biāo)注 達(dá)亞電銷(xiāo)機(jī)器人官網(wǎng) 外呼系統(tǒng)坐席費(fèi)計(jì)入會(huì)計(jì)哪個(gè)科目 大連400電話如何申請(qǐng)

針對(duì)一個(gè)tomcat中有的項(xiàng)目需要使用ssl加密有些可以直接訪問(wèn)的情況,可通過(guò)修改tomcat/conf下的server.xml來(lái)實(shí)現(xiàn)。具體配置可參考下面這段代碼,注意<Service name=”Catalina1″>這個(gè)標(biāo)簽中的配置。

<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
  <Listener className="org.apache.catalina.core.JasperListener" />
  <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
  <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">
    <!-- 此處使用了ssl配置,需用https才可訪問(wèn) -->
    <Connector port="8284" protocol="HTTP/1.1"
      connectionTimeout="20000"
      redirectPort="8443" URIEncoding="UTF-8"
      clientAuth="false" sslProtocol="TLS"
      SSLEnabled="true" scheme="https" secure="true"
      keystoreFile="conf/tomcat.jks" keystorePass="pico2012server"
      truststoreFile="conf/tomcat.jks" truststorePass="pico2012server"
      />
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
 
    <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">
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
          prefix="localhost_access_log." suffix=".txt"
          pattern="%h %l %u %t &quot;%r&quot; %s %b" />
 
      </Host>
    </Engine>
  </Service>
 
  <!-- 加入一個(gè)新的網(wǎng)站服務(wù)配置,每個(gè)service都可以單獨(dú)配置工程加載目錄、端口等 -->
  <Service name="Catalina1">
    <!-- 此處表示加載的工程仍使用原始的http方式訪問(wèn) -->
    <Connector port="8484" protocol="HTTP/1.1"
      connectionTimeout="20000"
      redirectPort="8443" URIEncoding="UTF-8"
      />
    <Connector port="18009" protocol="AJP/1.3" redirectPort="18443" />
 
    <Engine name="Catalina1" defaultHost="localhost">
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
          resourceName="UserDatabase"/>
      </Realm>
      <!-- 該service加載的工程放置目錄,與webapps同目錄的webapps1 -->
      <Host name="localhost" appBase="webapps1"
        unpackWARs="true" autoDeploy="true">
 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
          prefix="localhost_access_log." suffix=".txt"
          pattern="%h %l %u %t &quot;%r&quot; %s %b" />
        <!-- 此處要顯示的指定加載webapps1下的GS-Web工程 -->
        <Context path="" docBase="GS-Web" debug="0" reloadable="true"/>
      </Host>
    </Engine>
  </Service>
</Server>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

標(biāo)簽:新鄉(xiāng) 楊凌 湖南 衡水 南通 遼源 黃石 海東

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《tomcat同時(shí)使用http和https訪問(wèn)的配置方法》,本文關(guān)鍵詞  tomcat,同時(shí),使用,http,和,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《tomcat同時(shí)使用http和https訪問(wèn)的配置方法》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于tomcat同時(shí)使用http和https訪問(wèn)的配置方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章