[ 아파치 2.0.55 + 톰켓 5.5 연동 하기 ]

Posted 2006. 2. 13. 14:59 by alice201405


[ 아파치 2.0.55 + 톰켓 5.5 연동 하기 ]

1.설치 프로그램 목록
->jdk 1.5.0_05 다운로드 (Tomcat 5.5.12 버젼은 JDK 1.5 버젼에서만 실행됨)
http://java.sun.com/j2se/1.5.0/download.jsp 에서 다운로드 하면 됨.
환경변수에서 시스템 변수에
변수이름: JAVA_HOME
변수값: C:\Program Files\Java\jdk1.5.0_03 (자바 설치시 디렉토리 지정)

->Apache HTTP Server 2.0.55 다운로드
http://ftp.apache-kr.org/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi

->Tomcat 5.5.12 다운로드
http://archive.apache.org/dist/jakarta/tomcat-5/v5.5.9/bin/

->Tomcat Connectors 다운로드
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.15/
mod_jk-apache-2.0.55.so 파일을 다운 받는다.

2. 프로그램 설치
-> jdk 1.5.0_05 -> Apache HTTP Server 2.0.55 -> Tomcat 5.5.12

3.아파치 톰켓 연동 설정
(1)Apache 설정(Apache_Home->아파치 설치 디렉토리 폴더)
1.mod_jk-apache-2.0.55.so 파일을 Apache_Home/modules 폴더 안에 카피한다.
2.Apche_Home/conf 폴더 안에 httpd.conf 파일을 에디터로 연다.
a. LoadModule jk_module modules/mod_jk-apache-2.0.55.so 추가 한다.(173줄)
b. DocumentRoot "D:/Apache/tom" 자신이 쓸 홈디렉토리를설정한다.(228줄)
c. 위와 동일한 디렉토리를 지정한다.(253줄)
d. 파일목록을 보여부지 않기 위해 Options 옵션 뒤 Indexes FollowSymLinks 를 삭제 한다.(267줄)
e. index.jsp 를 자동으로 보여주기위해 DirectoryIndex 옵션에 index.jsp 를 추가한 다.(321줄)

f. 마지막에 아래의 구문은 전부 추가 한다.
아래의 구문중에 JkWorkersFile E:/Apache/Apache2/conf/workers2.properties 이부분은 자신의 아파치 홈폴더에 있는 conf 폴더 안에 workers2.properties 파일을 설정해 준다.
JkLogFile E:/Apache/Apache2/logs/mod_jk.log 이부분도 마찮가지로 자신의 홈폴더에 있는 log 폴더 안에 mod_jk.log 파일을 설정해 준다.




<-------------------------------여기부터---------------------------------->
# Where to find workers.properties
# Update this path to match your conf directory location (put workers.properties next to httpd.conf)
JkWorkersFile E:/Apache/Apache2/conf/workers2.properties
# Where to put jk logs
# Update this path to match your logs directory location (put mod_jk.log next to access_log)
JkLogFile E:/Apache/Apache2/logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
# JkOptions indicate to send SSL KEY SIZE, set when servlet engine is Tomcat 3.2.x (on by default
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
# JkRequestLogFormat set the request format
# Options Description
# %b Bytes sent, excluding HTTP headers (CLF format)
# %B Bytes sent, excluding HTTP headers
# %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
JkRequestLogFormat "%w %V %T"
# Send everything for context /examples to worker named worker1 (ajp13)
JkMount /examples/* worker1
# send all requests ending in .jsp to worker1
JkMount /*.jsp worker1
# send all requests ending /servlet to worker1
JkMount /*/servlet/ worker1
<-------------------------------여기까지---------------------------------->


g. Apche_Home/conf 폴더 안에 workers2.properties 이름의 파일을 새로만든후 아래 구문 을 넣고 저장한다.
<-------------------------------여기부터---------------------------------->
# Define 1 real worker using ajp13 worker.list=worker1 # 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.reclycle_timeout=300
[logger] level=DEBUG
[config:] file=${serverRoot}/conf/workers.properties debug=0 debugEnv=0
[uriMap:] info=Maps the requests. Options: debug debug=0
[shm:] info=Scoreboard. Required for reconfiguration and status with multiprocess servers file=${serverRoot}/logs/jk2.shm size=1048576 debug=0 disabled=00
[workerEnv:] info=Global server options timing=1 debug=0
[lb:lb] info=Default load balancer. debug=0
[channel.socket:localhost:8009] info=Ajp13 forwarding over socket port=8009 host=127.0.0.1 debug=0 tomcatId=localhost:8009
[ajp13:localhost:8009] channel=channel.socket:localhost:8009
[status:] info=Status worker, displays runtime informations
[vm:] info=Parameters used to load a JVM in the server process JVM=${JAVA_HOME}/jre/bin/client/jvm.dll classpath=${CATALINA_HOME}/bin/tomcat-jni.jar classpath=${CATALINA_HOME}/server/lib/commons-logging.jar #OPT=-Djava.class.path=c:\Program Files\Apache Group\Tomcat4.1\bin\tomcat-jni.jar OPT=-Dtomcat.home=${CATALINA_HOME} OPT=-Dcatalina.home=${CATALINA_HOME} OPT=-Xmx128M #OPT=-Djava.compiler=NONE disabled=0
# Uri mapping [uri:localhost/*.jsp] worker=ajp13:localhost:8009
[uri:www.test.com/*.jsp] worker=ajp13:localhost:8009
[uri:www.test.com/servlet/*] worker=ajp13:localhost:8009
[uri:/jkstatus/*] info=Display status information and checks the config file for changes. group=status:
[uri:/examples] info=Example webapp in the default context. context=/examples debug=0
[uri:/servlet/*] info=Servlet mapping
[uri:/*.jsp] info=Jsp mapping
<-------------------------------여기까지---------------------------------->

(2)Tomcat 설정(Tomcat_Home->톰켓 홈 디렉토리)
1.Tomcat_Home\conf 폴더에 있는 web.xml 파일을 에디터로 연다.
a. servlet 주석을 풀어준다. (92줄) invoker org.apache.catalina.servlets.InvokerServlet debug 0 2
b. servlet-mapping 주석을 풀어준다. (322줄) invoker /servlet/*
c. listings 의 param-value 를 false 로 수정 (63줄) default org.apache.catalina.servlets.DefaultServlet debug 0 listings false 1
2. Tomcat_Home\conf 폴더에 있는 jk2.properties 파일을 에디터로 연다.
a. handler.list=apr,request,channelJni 를 handler.list=apr,request 로 수정 b. shm.file=${jkHome}/work/jk2.shm 주석을 풀어줌. c. apr.jniModeSo=inprocess 의 주석을 풀어줌.

3. Tomcat_Home\conf 폴더에 있는 server.xml 파일을 에디터로 연다.
a. 주석 처리 (124줄)
b. 주석을 풀어줌. (120줄)
c. 주석 처리 (76줄)
d. webapps 는 Tomcat 의 Default DocumentRoot 임. 이것을 수정하기 위해서는 webapps 에 '/' 경로를 넣을 수 있음. 수정 (191줄)
e. path 는 default 로 "" 임. docBase 는 default 로 ROOT 임. documentRoot 를 바꾸기 위해 설정. 삽입 (196줄 정도)
docBace 안에 자신이 사용할 홈폴더를 지정한다. 아파치에서 사용한 홈폴더와 동일.

(3)실행
톰켓 재실행 -> 아파치 재실행
http://localhost 접속
톰켓 인덱스 화면이 뜨면 성공!!!