(*)아파치 웹서버 연동시 필요한 것들 입니다.
- <ol>
- 컴파일 된 jk 모듈 -- mod_jk.so 파일
- mo-jk.conf
- workers.properties
- uriwokermap.properties </ol>
(*) 간단한 설정 방법에 대해 알아 보겠습니다.
-
mod_jk<ol>
-
mod_jk 다운로드 및 설치<ol>
-
최신 버전의 mod_jk.so 파일을 APACHE_HOME/modules에 추가</ol>
-
아파치 httpd.conf 수정<ol>
-
APACHE_HOME/conf/httpd.conf 파일에 아래 라인을 추가 (*)
Include conf.d/mod-jk.conf </ol>
-
mod_jk.conf 작성
-
worker.properties 작성<ol>
-
연결할 JBoss 서버(worker) 정보 설정</ol>
-
uriworkermap.properties 작성<ol>
-
JBoss로 넘길 요청에 대한 URL 매핑 설정</ol>
-
Sticky Load Balancing을 사용할 경우에는 JBoss에도 설정이 필요<ol>
-
클러스터링 설명할때 설명드리도록 하겠습니다.</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 -
'SERVER > 회사서버셋팅중참조' 카테고리의 다른 글
tar 명령어 (0) | 2014.08.27 |
---|---|
apache 데몬 실행 권한 설정 (0) | 2014.08.27 |
[CentOS]상에서 apache + php + mysql 소스 컴파일의 이해 (0) | 2014.08.27 |
Apache 2.2 + mod_jk 1.2 ( load balancing ) + Tomcat 5.5 ( virtual hosting ) (0) | 2014.08.27 |
AIX에서 Apache2 + Tomcat5.5 + JK Connector설치 (0) | 2014.08.27 |
Apache + Tomcat 연동 설정 튜닝 (0) | 2014.08.27 |
AIX 6 에서 Apache, Tomcat 설치하기 (1) | 2014.08.27 |
【CentOS】Apache Httpd설치(2.2.17) (0) | 2014.08.27 |