1. 程式人生 > >linux tomcat繫結多個域名

linux tomcat繫結多個域名

<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<!-- Note:  A "Server" is not itself a "Container", so you may not
     define subcomponents such as "Valves" at this level.
     Documentation at /docs/config/server.html
 -->
<Server port="8005" shutdown="SHUTDOWN">
  <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
  <!-- Security listener. Documentation at /docs/config/listeners.html
  <Listener className="org.apache.catalina.security.SecurityListener" />
  -->
  <!--APR library loader. Documentation at /docs/apr.html -->
  <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>
    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users
    -->
    <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>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" Note:  A "Service" is not itself a "Container",
       so you may not define subcomponents such as "Valves" at this level.
       Documentation at /docs/config/service.html
   -->
  <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"/>
    -->


    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned. Documentation at :
         Java HTTP Connector: /docs/config/http.html
         Java AJP  Connector: /docs/config/ajp.html
         APR (HTTP/AJP) Connector: /docs/apr.html
         Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
    -->
    <Connector port="80" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    <!-- A "Connector" using the shared thread pool-->
    <!--
    <Connector executor="tomcatThreadPool"
               port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
         This connector uses the NIO implementation. The default
         SSLImplementation will depend on the presence of the APR/native
         library and the useOpenSSL attribute of the
         AprLifecycleListener.
         Either JSSE or OpenSSL style configuration may be used regardless of
         the SSLImplementation selected. JSSE style configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
               maxThreads="150" SSLEnabled="true">
        <SSLHostConfig>
            <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->
    <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
         This connector uses the APR/native implementation which always uses
         OpenSSL for TLS.
         Either JSSE or OpenSSL style configuration may be used. OpenSSL style
         configuration is used below.
    -->
    <!--
    <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
            <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
                         certificateFile="conf/localhost-rsa-cert.pem"
                         certificateChainFile="conf/localhost-rsa-chain.pem"
                         type="RSA" />
        </SSLHostConfig>
    </Connector>
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />


    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host).
         Documentation at /docs/config/engine.html -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
    -->
    <Engine name="Catalina" defaultHost="locahost">

      <!--For clustering, please take a look at documentation at:
          /docs/cluster-howto.html  (simple how to)
          /docs/config/cluster.html (reference documentation) -->
      <!--
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      -->

      <!-- Use the LockOutRealm to prevent attempts to guess user passwords
           via a brute-force attack -->
      <Realm className="org.apache.catalina.realm.LockOutRealm">
        <!-- This Realm uses the UserDatabase configured in the global JNDI
             resources under the key "UserDatabase".  Any edits
             that are performed against this UserDatabase are immediately
             available for use by the Realm.  -->
        <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
               resourceName="UserDatabase"/>
      </Realm>

      <Host name="www.lovett.top"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
			 <Context path="" docBase="/home/ftpuser/apache-tomcat/webapps/lovett" debug="0" reloadable="true" />			 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
      </Host>
	  
	        <Host name="lovett.top"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
			 <Context path="" docBase="/home/ftpuser/apache-tomcat/webapps/lovett" debug="0" reloadable="true" />			 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
      </Host>  
	  
	  
	  	        <Host name="www.uptv.top"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
			 <Context path="" docBase="/home/ftpuser/apache-tomcat/webapps/uptv" debug="0" reloadable="true" />			 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
      </Host>
	    
	        <Host name="uptv.top"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">
			 <Context path="" docBase="/home/ftpuser/apache-tomcat/webapps/uptv" debug="0" reloadable="true" />			 
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t "%r" %s %b" />
      </Host>
	  
    </Engine>
	
	
  </Service>
</Server>

修改埠號

對映域名


注意:該地址為專案的絕對路徑

docBase="/home/ftpuser/apache-tomcat/webapps/uptv"


相關推薦

linux tomcat域名

<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor li

Tomcat域名和配置虛擬目錄的方法

server.xml 的修改方式如下: (一)多域名繫結 1.如果你要繫結網站,首先是要把tomcat的預設訪問埠8080,修改成80 原始: <Connector port="8080" maxHttpHeaderSize="8192" maxThreads

使用 Nginx 為 Linux 例項域名

Nginx 是一款廣泛應用的 Web 伺服器,常用於反向代理、負載均衡器以及 HTTP 快取等。本文以 CentOS 6.8 為例,提供使用 Nginx 服務為 Linux 例項繫結多個域名的方法。您可以: 遠端連線並登入到 Linux 例項。 執行命令 cd /etc/nginx/conf.d 開啟

tomcat下一個專案如何域名

<Host name="localhost" debug="0" appBase="D:\\Tomcat 5.0\\webapps"        unpackWARs="true" autoDeploy="true"        xmlValidation="fa

關於一個伺服器中域名——公司是用阿里雲伺服器--是使用tomcat

我是使用多個tomcat來新增 由於之前已經有一個tomcat,而且上面已經有了一個專案,專案使用的埠號是8080,然而瀏覽器預設的埠號是80,如果將server.xml修改了埠,那之前的專案就會出錯了,所以要繫結域名又不想更改埠號就建立多一個tomcat了 1.將tom

Tomcat下配置javaWeb,一個IP域名

本文以繫結3個javaWeb專案為例,講述一個IP地址繫結3個個域名: (1)首先準備好3個javaWeb的war包; (2)在Tomcat下建立3個不同名稱的資料夾,如webapps、webapps

nginx 輔助 同一個tomcat二級域名及輔助tomcat二級域名

公司現階段部署環境,一臺Linux伺服器,部署了4個專案,一個專案A 單獨使用一個tomcatA     ,專案B,C,D 使用同一個tomcat B。 一開始BCD專案通過配置tomcat 配置檔案中Server.xml 中的HOST 節點來達到同一個tomcat使用

一個ip域名

一個ip繫結一個域名 apache伺服器文章中我有介紹apache配置網站,講解一個ip繫結一個域名的步驟和方法。 配置過程: 啟動httpd-vhosts.conf(在httpd.conf檔案中,找到Virtual hosts虛擬主機)

如何理解一臺伺服器可以ip,一個ip可以域名

一個域名只能對應一個IP的意思是域名在DNS伺服器裡做解析的時候 一條記錄只能指向一個IP地址。這個是死規定,試想一下,如果一個子域名指向了2個ip ,當訪問者開啟這個域名的時候,瀏覽器是展示哪個IP上的網站呢?一個IP可以對於多個域名的意思是:一個IP繫結到一臺伺服器的時候,在伺服器上可以設定多個主機頭,每

同一個伺服器域名,利用Nginx進行域名重定向

背景:同一個伺服器繫結多個域名,利用Nginx進行域名重定向。 首先:tomcat進行部署網站後臺介面,進行重設9090埠(可根據需要自定義,但是注意外網訪問埠,需在阿里雲上配置開放埠)。   Tomcat版本8.044,Nginx版本nginx-1.14.1 Tomcat

設定nginx域名

nginx繫結多個域名,可把多個域名規則寫一個配置檔案裡,也可分別建立多個域名配置檔案,一般為了管理方便,建議每個域名建一個檔案,有些同類域名也可寫在一個總的配置檔案裡。 一、每個域名一個檔案的寫法 首先開啟nginx域名配置檔案存放目錄:/usr/local/nginx/conf/servers ,如要

apache2虛擬主機實現一個伺服器域名

1.apache2的配置 首先要配置好apache2,如果未配置,請參考我之前的博文:lamp的配置 2.域名的解析 將全部域名的www和@的A記錄解析到雲伺服器的IP 3.虛擬主機的配置

Apache 同一個IP:埠,域名的注意事項

Aapche 如果需要繫結多個域名到一個IP上,是支援的。需要注意以下2點: 1 必須要開啟 NameVirtualHost開關選項, 如:NameVirtualHost 220.231.220.231:80 2 NameVirtualHost 需要指定具體的埠

關於nginx為站點域名以及域名

環境: 系統:Centos6.+版本 使用lnmp一鍵安裝包安裝環境(配置檔案地址在其官網有寫) 找到nginx的conf檔案,我的目錄為: /usr/local/nginx/conf

.nginx的虛擬主機功能(nginx站點,域名)

兩個虛擬主機(純靜態-html 支援) - Two Virtual Hosts, Serving Static Files http {     server {         listen          80;         server_name     w

如何在同一臺VPS上使用apache域名(親測可行!!!)

基於域名的虛擬主機相對比較簡單,因為你只需要配置你的DNS伺服器將每個主機名對映到正確的IP地址,然後配置Apache HTTP伺服器,令其辨識不同的主機名就可以了。基於域名的伺服器也可以緩解IP地址不足的問題。所以,如果沒有特殊原因使你必須使用基於IP的虛擬主機,您最好還是使用基於域名的虛擬主機。下列情

LinuxTomcat下配置域名與對應工程相連

1.如何實現修改Linux下Tomcat的埠號。 我們都知道,你的Linux伺服器上的Tomcat安裝配置好後,可以通過ip+:8080埠號訪問,如果想修改埠號,可以通過修改conf目錄下的server.xml檔案來實現。(溫馨提示:以下server.xml配置的修改在修改

linux下如何實現為一個網絡卡IP地址

Linux的網路裝置配置檔案存放在/etc/sysconfig/network-scripts裡面,對於乙太網的第一個網路裝置,配置檔名一般為 ifcfg-eth0 如果需要為第一個網路裝置繫結多一個IP地址,只需要在/

【常用】查詢輸入框:一個關鍵字屬性(包括int、string不同的型別)

從input獲取輸入一個待查詢關鍵字key,前端不區分,傳到後臺再進行處理,基本邏輯如下: //根據訂單號(int)或者供應商名稱(string)查詢訂單 if (!string.IsNullOrEmpty(key)) { var Id = MathTools.ToInt(key);

對同一個物件響應事件並都執行,和此例子的相容程式碼

要點: 1.因為 onclick=" "  新增的元素響應事件,先新增的事件,會被後來新增的事件層疊掉,只能執行最後一個響應的事件 所以要用到事件監聽addElementLitener()來繫結多個處理函式,而因為相容性的問題需要相容程式碼。 2.在IE8中,addE