블로그 이미지
좋은느낌/원철
이것저것 필요한 것을 모아보렵니다.. 방문해 주셔서 감사합니다..

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

    2009. 6. 11. 17:44 개발/Linux 계열

    아파치 톰켓 연동하기

     OS =  linux redhat 9.0
    아파치 버젼 : 1.3.31
    Tomcat 버젼 : 5.0.28
    Connectors  : jakarta-tomcat-connectors-jk2-2.0.4-src

    1. 아파치 설치
     가. tar -xvzf apache_1.3.31.tar.gz
     나. ./configure --prefix=/usr/local/apache --enable-rule=SHARED_CORE --enable-shared=max --enable-module=so
     다. make
     라. mkke install
     설치 완료

    2. connector 만들기(mod_jk2.so)
     가. tar xvzf jakarta-tomcat-connectors-jk2-src-current.tar.gz
     나. apr-0.9.4.tar.gz , apr-util-0.9.4.tar.gz 파일이 필요함
        참고 http://mirror.apache.or.kr/apr/apr-0.9.4.tar.gz
             http://mirror.apache.or.kr/apr/apr-util-0.9.4.tar.gz
        위 2개 파일을 받아 압축을 푼다.
     다. cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/
     라. ./buildconf.sh 
     마. ./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=/경로/apr-0.9.4 --with-apr-util=/경로/apr-util-0.9.4
     바. make 
     사. cd jakarta-tomcat-connectors-jk2-2.0.4-src/jk/build/jk2/apache13 로 이동
     아. cp mod_jk2.so /usr/local/apache/libexec/mod_jk2.so
     자. chmod 755 /usr/local/apache/libexec/mod_jk2.so
     차. cp jakarta-tomcat-connectors-jk2-2.0.4-src/jk/conf/workers2.properties /usr/local/apache/conf 에 복사

    3. apahce 환경 설정
     가. /usr/local/apahce/conf/httpd.conf 수정
         # Apache Tomcat5 Connector
           LoadModule jk2_module         libexec/mod_jk2.so
           AddModule mod_jk2.c
           추가
     나. User nobody --> xxx 사용자로
         Group nobody --> xxx 그룹 사용자로 이걸 수정하는 이유는 기본적으로 apache는 nobody 유저로 나중에권한문제가
          생길수 있기때문에 변경한다. 보통 403 에러가 나타남.

     다. DocumentRoot "/usr/local/apache/htdocs" 는 jsp 파일이 놓일 위치다 변경가능 (tomcat의 context 위치와 같게 설정한다.)
         같이 변경
     
     라. 
     DirectoryIndex index.html index.jsp -> index.jsp 추가한다. 
     

     마. Options Indexes FollowSymLinks MultiViews 이부분을 주석으로 막는다.( http://www.xxx.com/ 이런경우 주석으로 처리하면 
           파일리스트 목록이  보이는 현상을 제거한다.

    4. /usr/local/apache/conf/workers2.properties 수정
       
     [logger]
     level=DEBUG

     [config:]
     file=${serverRoot}/conf/workers2.properties
     debug=0
     debugEnv=0

     [uriMap:]
     info=Maps the requests. Options: debug
     debug=0

     # Alternate file logger
     #[logger.file:0]
     #level=DEBUG
     #file=${serverRoot}/logs/jk2.log

     [shm:]
     info=Scoreboard. Required for reconfiguration and status with multiprocess servers
     file=${serverRoot}/logs/jk2.shm
     size=1000000
     debug=0
     disabled=0

     [workerEnv:]
     info=Global server options
     timing=1
     debug=0
     # Default Native Logger (apache2 or win32 )
     # can be overriden to a file logger, useful
     # when tracing win32 related issues
     #logger=logger.file:0

     [lb:lb]
     info=Default load balancer.
     debug=0

     [lb:lb_1]
     info=A second load balancer.
     debug=0
     [channel.socket:localhost:8009]

     info=Ajp13 forwarding over socket
     debug=0
     tomcatId=localhost:8009

     [channel.socket:localhost:8019]
     info=A second tomcat instance.
     debug=0
     tomcatId=localhost:8019
     lb_factor=1
     group=lb
     group=lb_1
     disabled=0

     [channel.un:/opt/33/work/jk2.socket]
     info=A second channel connecting to localhost:8019 via unix socket
     tomcatId=localhost:8019
     lb_factor=1
     debug=0

     [channel.jni:jni]
     info=The jni channel, used if tomcat is started inprocess

     [status:]
     info=Status worker, displays runtime informations

     [vm:]
     info=Parameters used to load a JVM in the server process
     #JVM=C:\jdk\jre\bin\hotspot\jvm.dll
     classpath=${TOMCAT_HOME}/bin/tomcat-jni.jar
     classpath=${TOMCAT_HOME}/server/lib/commons-logging.jar
     OPT=-Dtomcat.home=${TOMCAT_HOME}
     OPT=-Dcatalina.home=${TOMCAT_HOME}
     OPT=-Xmx128M
     #OPT=-Djava.compiler=NONE
     disabled=1

     [worker.jni:onStartup]
     info=Command to be executed by the VM on startup. This one will start tomcat.
     class=org/apache/jk/apr/TomcatStarter
        #ARG=start
     # For Tomcat 5 use the 'stard' for startup argument
        ARG=stard
     disabled=1
     stdout=${serverRoot}/logs/stdout.log
     stderr=${serverRoot}/logs/stderr.log

     [worker.jni:onShutdown]
     info=Command to be executed by the VM on shutdown. This one will stop tomcat.
     class=org/apache/jk/apr/TomcatStarter
     ARG=stop
     disabled=1

     [uri:/jkstatus/*]
     info=Display status information and checks the config file for changes.
     group=status:

     [uri:127.0.0.1:8003]
     info=Example virtual host. Make sure myVirtualHost is in /etc/hosts to test it
     alias=myVirtualHost:8003

     [uri:127.0.0.1:8003/ex]
     info=Example webapp in the virtual host. It'll go to lb_1 ( i.e. localhost:8019 )
     context=/ex
     group=lb_1


     [ajp13:localhost:8009]
     channel=channel.socket:localhost:8009

     [uri:/*.jsp]
     info=All jsp page  mapping


     [uri:localhost/*.jsp]
     info=All jsp page  mapping
     worker=ajp13:localhost:8009

     [uri:/servlet/*]
     info=All Servlet  page  mapping

     [uri:/*]

     위와 같이 설정했음.

    5. Tomcat5 설치
     가. tar -xvzf jakarta-tomcat-5.0.28.tar.gz  
        나. conf/server.xml 수정
       
          위 부분 주석처리

       
                   port="8009" minProcessors="5" maxProcessors="75"
                   enableLookups="true" redirectPort="8443" acceptCount="10"
                   debug="0" connectionTimeout="20000" useURIValidationHack="false"
                   protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" />
          위 부분 추가

        
                  위 부분 주석 해제

       
        위 부분 주석처리

          appBase="webapps" 를 -- >"/" 수정했음.
          unpackWARs="true" autoDeploy="true"
          xmlValidation="false" xmlNamespaceAware="false">
        
         
         위 부분 추가
     
     6. conf/jk2.properties  수정
        # Set the desired handler list
      handler.list=apr,request
     # handler.list=apr,request,channelJni
     #
     # Override the default port for the socketChannel
      channelSocket.port=8019
     # Default:
     # channelUnix.file=${jkHome}/work/jk2.socket
     # Just to check if the the config  is working
      shm.file=${jkHome}/work/jk2.shm

     # In order to enable jni use any channelJni directive
     # channelJni.disabled = 0
     # And one of the following directives:

     # apr.jniModeSo=/opt/apache2/modules/mod_jk2.so

     # If set to inprocess the mod_jk2 will Register natives itself
     # This will enable the starting of the Tomcat from mod_jk2
      apr.jniModeSo=inprocess

      위 와같이 설정했음.

    posted by 좋은느낌/원철