관리 메뉴

IT.FARMER

Virtual Hosting and Tomcat Server.xml crossContext,, Muiltple 본문

Web Server, WAS/Tomcat

Virtual Hosting and Tomcat Server.xml crossContext,, Muiltple

아이티.파머 2010. 6. 28. 17:39
반응형
1. 서버를 두개 이상 띄우는 경우
server.xml으 port를 중복안대게 설정해주면 해결

2. 서버 하나에 여러 컨텍스트 띄우기.
 
  • C:\java\apache_esh\apache-tomcat-6.0.20\conf 
  • server.xml 을 메모장이나 EditPlus로 오픈 합니다.
          
         <Host name="localhost"  appBase="webapps" debug="0" 
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
  </Host>

   <Host name="smartdev.soft.com" appBase="webapps1" debug="0" 
                 unpackWARs="true" autoDeploy="true"
                 xmlValidation="false" xmlNamespaceAware="false">
          </Host>

     
  <Host name="smartdevext.soft.com" appBase="webapps2" debug="0" 
                 unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
          </Host>

ROOT로 context를 설정하기에 appBase 가 달라야한다. 
같은 ROOT(/) Context를 사용함으로 Virtual Host의 뒤에 지정한 내용Error 발생
https://tomcat.apache.org/tomcat-8.0-doc/virtual-hosting-howto.html

  • localhost라는 명으로 Host명이 존재 하는데 그것을 카피 하여, 위와 같이 사용하고자 하는 도메인명으로 변경 
  • 이 Host명을  실행>drivers , ext 폴더 이동후 Host 파일을 열어
  • 자신의 아이피 smartdev.soft.com, smartdevext.soft.com 를 추가합니다.

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost db.server bpm.server bpm.engine engine.server   maninsoft.smartworks 

127.0.0.1       smartdevext.soft.com
127.0.0.1       smartdev.soft.com

166.125.33.187 smartevext.soft.com
166.125.33.187 smartdev.soft.com

  • 자 다음 폴더로 C:\java\apache_esh\apache-tomcat-6.0.20\conf\Catalina\  이동합니다
  • smartevext.soft.com 폴더를 생성합니다,
  • smartdev.soft.com  또한 생성합니다.
  • 각 폴더로 들어가서 ROOT.xml을 생성합니다. (localhost의 파일을 복사 해서 사용)
  • 각 ROOT.xml의 내용을 다음과 같이 변경합니다
1. smartdevext.soft.com

<Context crossContext="true" path="/" docBase="C:\Site\mis\smartdevext\WebContent" debug="0" reloadable="true" >
<Logger className="org.apache.catalina.logger.FileLogger" prefix="smartserver_log." suffix=".txt" timestamp="true"/>
</Context>
2. smartdev.soft.com

<Context crossContext="true" path="/" docBase="C:\Site\mis\smartdev\WebContent" debug="0" reloadable="true" >
<Logger className="org.apache.catalina.logger.FileLogger" prefix="smartserver_log." suffix=".txt" timestamp="true"/>
</Context
  • 다음과 같이 docBase를 설정 합니다.  서버 Start후 
  • http://smartdevext.soft.com
  • http://smartdev.soft.com 으로 접속하여, 정상적으로 작동하는지 확인합니다.

    3. 하나의 도메인에 



    반응형

    'Web Server, WAS > Tomcat' 카테고리의 다른 글

    Tomcat 로그 관리 (logrotate.d)  (0) 2017.07.06
    Tomcat 메모리 설정  (0) 2017.07.06
    Tomcat bash, bat JAVA_HOME 설정  (2) 2014.03.26
    Tomcat 원격 디버깅  (0) 2011.03.30