728x90
반응형

(*)아파치 웹서버 연동시 필요한 것들 입니다.

    <ol>
  1. 컴파일 된 jk 모듈  -- mod_jk.so 파일
  2. mo-jk.conf
  3. workers.properties
  4. uriwokermap.properties
  5. </ol>

(*) 간단한 설정 방법에 대해 알아 보겠습니다.

  1. mod_jk
  2. <ol>
  3.  mod_jk 다운로드 및 설치
  4. <ol>
  5. 최신 버전의 mod_jk.so 파일을 APACHE_HOME/modules에 추가
  6. </ol>
  7. 아파치 httpd.conf 수정
  8. <ol>
  9. APACHE_HOME/conf/httpd.conf 파일에 아래 라인을 추가 (*)
     Include conf.d/mod-jk.conf
  10. </ol>
  11. mod_jk.conf 작성
  12. worker.properties 작성
  13. <ol>
  14. 연결할 JBoss 서버(worker) 정보 설정
  15. </ol>
  16. uriworkermap.properties 작성
  17. <ol>
  18. JBoss로 넘길 요청에 대한 URL 매핑 설정
  19. </ol>
  20. Sticky Load Balancing을 사용할 경우에는 JBoss에도 설정이 필요
  21. <ol>
  22. 클러스터링 설명할때 설명드리도록 하겠습니다.
  23. </ol></ol>
  • mod-jk.conf
    • mod_jk가 지원하는 아파치 지시어를 사용해 mod_jk를 설정
    • APACHE_HOME/conf.d/mod-jk.conf 파일을 생성

       LoadModule jk_module modules/mod_jk.so

      JkWorkersFile conf.d/workers.properties
      JkLogFile logs/mod_jk.log
      JkLogLevel error
      JkLogStampFormat  "[%a %b %d %H:%M:%S %Y]"
      JkRequestLogFormat "%w %V %T"

      JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
      JkMountFile conf.d/uriworkermap.properties
      #JkShmFile logs/jk.shm

      <Location /jkstatus/>
          JkMount jkstatus
          Order deny,allow
          Deny from all
          Allow from 127.0.0.1
      </Location>


    • 아파치 웹서버 구동시 로드할 플러그인 모듈 설정
      •  LoadModule jk_module modules/mod_jk.so
    • jk 워커파일의 위치와 이름 설정 ( 기본명은 : workers.properties)
      • 별도 파일로 분리하지 않고 JkWorkerProperty 지시어를 사용해 바로 worker를 설정할 수도 있음
      • JkWorkersFile conf.d/workers.properties
    • 플러그인 구동시 생성되는 로드 파일의 위치 와 이름 설정
      • 웹서버 프로세스 실행 계정이 해당 디렉터리에 쓰기 권한이 있어야 함
      • JkLogFile logs/mod_jk.log
    • 로그레벨 설정
      • JkLogLevel error
      • trace | debug | info | warn | error   (기본값은 info)
    • 로그에 찍힐 타임스탬프 포맷 설정
      • JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
    • 로그에 찍힐 요청 포맷 설정
      • JkRequestLogFormat "%w %V %T"
    • jk 옵션 설정
      • JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
    • jk 마운트 파일에 대한 위치와 이름 설정
      • JkMountFile conf.d/uriworkermap.properties
    • JkShmFile은 로드 밸런싱시에 사용
      • #JkShmFile logs/jk.shm
    • jkstatus를 통해 웹으로 모니터링 및 설정이 가능하므로 접근 제한이 필요
    • JkOptions이 mod_jk 버전에 따라 디폴트값이 변경되는 경우가 있음.
  • mod_jk Apache 지시어
    • JkRequestLogFormat
      • 기본값이 없으며, 이 포맷이 설정되지 않은 경우 request는 log 파일에 기록되지 않음

       

 Options

 Description

%b 

Bytes sent, excluding HTTP headers (CLF format)  

%B 

Bytes sent, excluding HTTP header 

%H

The request protocol  

%m

The request method 

%p 

The canonical Port of the server serving the request 

 %q

The query string (prepended with a ? if a query string exists, otherwise an empty string)  

 %r

First line of request  

 %s

 Request HTTP status code

 %T

Request duration, elapsed time to handle request in seconds '.' micro seconds  

 %U

The URL path requested, not including any query string  

 %v

 The canonical ServerName of the server serving the request

 %V

 The server name according to the UseCanonicalName setting

 %w

 Tomcat worker name

 %R

Real worker name 

 

 



 

 

 

 

    • JkOptions
      •  request 전달시 적용할 옵션
      •  +option: enable
      •  -option: disable

        Options 

        Description 

        ForwardURICompatUnparsed  

        the forwarded URI will be unparsed. It's spec compliant and secure. It will always forward the original request URI, so rewriting URIs with mod_rewrite and then forwarding the rewritten URI will not work  

        ForwardDirectories  

         JkOptions ForwardDirectories is used in conjunction with DirectoryIndex directive of Apache web server .

        If ForwardDirectories is set to true and Apache doesn't find any files that match, the request will be forwarded to Tomcat for resolution

        ForwardKeySize 

        forward also the SSL Key Size as required by Servlet API 2.3. This flag shouldn't be set when servlet engine is Tomcat 3.2.x (on by default).

        ForwardSSLCertChain  

         forward SSL certificate chain (off by default)



         
    • JkMountFile
      • URL mapping을 정의한 파일의 위치를 설정
      • 파일이 변경되면 mod_jk는 내용을 리로드
      • 분리된 파일로 정의하지 않고 JkMount 지시어를 사용해 바로 정의 가능( 아파치 에서 버츄얼 호스팅 사용시 사용)
    • JkMount 지시어
      • worker에 특정 URL을 매핑
      • JkMount [URL prefix]  [Worker name]
            # send all requests ending in .jsp to worker1
            JkMount /*.jsp worker1
            # send all requests ending /servlet to worker1
            JkMount /*/servlet/ worker1
            # send all requests jsp requests to files located in /otherworker will go worker2
            JkMount /otherworker/*.jsp worker2
    • JkUnmount 지시어
      • worker의 URL 매핑에서 특정 URL 패턴은 제외
             # do not send requests ending with .gif to worker1
             JkUnMount /*.gif worker1
             # The .gif files will not be mounted cause JkUnMount takes
             # precedence over JkMount directive
            JkMount /servlet/*.gif worker1

728x90
반응형
블로그 이미지

nineDeveloper

안녕하세요 현직 개발자 입니다 ~ 빠르게 변화하는 세상에 뒤쳐지지 않도록 우리모두 열심히 공부합시다 ~! 개발공부는 넘나 재미있는 것~!

,