apache + tomcat mod_jk 연동
운영체제/Unix (Ubuntu Linux) / 2009/12/28 22:34
1. mod_jk 다운로드
http://tomcat.apache.org/download-connectors.cgi
1.2 소스를 다운로드 한다.
tomcat-connectors-1.2.28-src.tar.gz 파일임.
2. 설치
tomcat-connectors-1.2.28-src.tar.gz 압축을 풀고 BUILD.txt 를 통해 설치 ($>부분은 BUILD.txt에 나온 설명임)
$> cd native : native 디렉토리로 이동
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native
$> ./configure --with-apxs=/usr/sbin/apxs (or where ever the apxs/apxs2 is) : 아파치에 apxs 위치를 확인한 후에 명령어를 실행한다.
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native$ ./configure --with-apxs=/claztec/server/httpd/bin/apxs
$> make
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native/apache-2.0 에 mod_jk.so가 만들어 졌다.
$> su -c 'make install'
이 명령어를 안하고 수동으로 아파치 모듈에 mod_jk.so를 복사한다.
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native/apache-2.0$ cp -p mod_jk.so /claztec/server/httpd/modules/
3. 설정
설정에 여러가지 방법이 있겠지만
http.conf 에서 mod_jk.conf 파일을 로드해서 worker.properties 를 읽어서 설정하도록 함.
http.conf 파일
Include conf/mod_jk.conf
mod_jk.conf 파일
Alias /examples/ "/claztec/server/tomcat/webapps/examples/"
<IfModule dir_module>
DirectoryIndex index.html index.jsp
</IfModule>
<Directory "/claztec/server/tomcat/webapps/examples">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
LoadModule jk_module modules/mod_jk.so
#worker.properties 위치
JkWorkersFile "conf/worker.properties"
#로그 위치
JkLogFile "logs/mod_jk.log"
#로그 레벨
JkLogLevel info
#로그 문자열 포멧
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "[%w %V %T]"
#url 매핑
JkMount /*.jsp worker1
JkMount /servlet/* worker1
#폴더에 관계없이 모든 jsp매핑
JKMount /* worker1
worker.properties 파일
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
4. 테스트
http://localhost/example 이 제대로 동작하는지 확인
http://tomcat.apache.org/download-connectors.cgi
1.2 소스를 다운로드 한다.
tomcat-connectors-1.2.28-src.tar.gz 파일임.
2. 설치
tomcat-connectors-1.2.28-src.tar.gz 압축을 풀고 BUILD.txt 를 통해 설치 ($>부분은 BUILD.txt에 나온 설명임)
$> cd native : native 디렉토리로 이동
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native
$> ./configure --with-apxs=/usr/sbin/apxs (or where ever the apxs/apxs2 is) : 아파치에 apxs 위치를 확인한 후에 명령어를 실행한다.
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native$ ./configure --with-apxs=/claztec/server/httpd/bin/apxs
$> make
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native/apache-2.0 에 mod_jk.so가 만들어 졌다.
$> su -c 'make install'
이 명령어를 안하고 수동으로 아파치 모듈에 mod_jk.so를 복사한다.
claztec@claztec:/claztec/server/tomcat-connectors-1.2.28-src/native/apache-2.0$ cp -p mod_jk.so /claztec/server/httpd/modules/
3. 설정
설정에 여러가지 방법이 있겠지만
http.conf 에서 mod_jk.conf 파일을 로드해서 worker.properties 를 읽어서 설정하도록 함.
http.conf 파일
Include conf/mod_jk.conf
mod_jk.conf 파일
Alias /examples/ "/claztec/server/tomcat/webapps/examples/"
<IfModule dir_module>
DirectoryIndex index.html index.jsp
</IfModule>
<Directory "/claztec/server/tomcat/webapps/examples">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
LoadModule jk_module modules/mod_jk.so
#worker.properties 위치
JkWorkersFile "conf/worker.properties"
#로그 위치
JkLogFile "logs/mod_jk.log"
#로그 레벨
JkLogLevel info
#로그 문자열 포멧
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "[%w %V %T]"
#url 매핑
JkMount /*.jsp worker1
JkMount /servlet/* worker1
#폴더에 관계없이 모든 jsp매핑
JKMount /* worker1
worker.properties 파일
worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
4. 테스트
http://localhost/example 이 제대로 동작하는지 확인
TAG
mod_jk

69-language-selector-ko-kr.conf