본문 바로가기

Linux

우분투에 아파치 + 톰캣 연동하기

우분투에 아파치 + 톰캣 연동하기

 

아파치, 톰켓 설치

 

mod_jk 설치 (apache - tomcat connector)

  • 시냅틱 패키지 관리자로 설치

    • mod_jk 가 mod_jk2 보다 최신 버전임
  1. $ sudo apt-get install libapache2-mod-jk
  • 경로정보

/etc/apache2/mods-available/jk.load

/usr/lib/apache2/modules/mod_jk.so

 

mod_jk 설정

  • /etc/libapache2-mod-jk/uriworkermap.properties 파일 생성
  1. /jkstatus*=status
  2. /*.jsp=worker1
    /*.do=worker1

    -->난  uriworkermap.properties 이게 안먹혀서 직접 /etc/apache2/sites-enabled/000-default에 마운트 하는 코드를 넣으니 되더라... 
  3.     DocumentRoot /var/www
  4. #   DocumentRoot /var/lib/tomcat6/webapps/ROOT/
  5.     JkMount /*.jsp worker1
  6.     JkMount /jkstatus status
  7.     JkMount /*.do worker1
  • /etc/libapache2-mod-jk/workers.properties 파일 생성
  1. worker.list=worker1, status
  2. # Set properties for worker1 (ajp13)
    worker.worker1.type=ajp13
    worker.worker1.host=localhost
    worker.worker1.port=8009
    worker.worker1.lbfactor=50
    worker.worker1.cachesize=10
    worker.worker1.cache_timeout=600
    worker.worker1.socket_keepalive=1
    worker.worker1.socket_timeout=300
  3.  
  4. # Set properties for jkstatus
  5. worker.status.type=status
  • /etc/apache2/mods-available/jk.conf 생성
  1. # Where to find workers.properties
    JkWorkersFile /etc/libapache2-mod-jk/workers.properties

    # Where to put jk logs
    JkLogFile /var/log/apache2/jk.log
    # Set the jk log level [debug/error/info]
    JkLogLevel info
    # Select the log format
    JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
    # JkRequestLogFormat
    JkRequestLogFormat "%w %V %T"

    # JkOptions indicates to send SSK KEY SIZE
    JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories

    # Mount your applications
    #JkMount /application/* loadbalancer
    # You can use external file for mount points.
    # It will be checked for updates each 60 seconds.
    # The format of the file is: /url=worker
    # /examples/*=loadbalancer
    JkMountFile /etc/libapache2-mod-jk/uriworkermap.properties
  • jk module 사용
  1. $ sudo a2enmod jk
  • apache, tomcat 재시작
  • 동작확인

http://localhost

http://localhost:8080

http://localhost/jkstatus


출처 : http://duddns.springnote.com/pages/4645637

 

'Linux' 카테고리의 다른 글

mysql - 외부접속 허용하기  (0) 2011.06.30
Virtual Hosting with Tomcat  (0) 2011.05.30
synergy linux build  (0) 2011.05.25
VIM 펑션키 맵핑  (0) 2011.04.24
SSL서비스 구축 및 OpenSSL  (0) 2011.04.14