Skip to content

조회 수 21037 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

아파치 설치 여부 확인

 rpm -qa | grep httpd

 해서 설치 여부를 확인 한다. fedora core 5 이상에서는 패키지를 프로그램-->Add/Remove Software 에서

직접 삭제 추가 할수 있다.

 

JDK 설치

 

 

 1-1. JDK 다운로드 

       - http://java.sun.com 에 방문해서 리눅스용 JDK를 다운로드 받는다.

       - self-extracting file 선택, 파일명 jdk-6-linux-i586.bin (현재 최신 버전은 1.6 버전입니다.)

       - 참고) tomcat 5.5 버전에서는 J2SE 5.0 이상 버전에서 동작함.

     

 

 1-2. 다운로드 받은 파일을 리눅스의 알맞은 폴더에 업로드한다.


 1-3. 다음 명령을 사용해서 bin 파일을 실행 가능하도록 변경한다.
       $ chmod 555 jdk-6-linux-i586.bin

 

 1-4. bin 파일을 실행한다.
       $ ./jdk-6-linux-i586.bin

 

 1-5. 실행하면 라이센스에 대한 내용을 물어보는데 yes 를 입력한다.


 1-6. 설치가 자동으로 된다.

       보통 /use/local 폴더에서 bin 파일을 실행하면 /usr/local/jdk1.6.0 폴더에 설치됩니다.

 

 1-7. 링크를 걸어 표기하기 쉽게 한다.

       # ln -s j2sdk jdk1.6.0

 

 

톰캣의 설치

 

  2-1. TOMCAT 다운로드 

        - http://tomcat.apache.org 에 방문해서 tar.gz의 톰캣 바이너리 배포판을 다운로드 받는다.

        - Core 를 받는다. 파일명은 apache-tomcat-5.5.20.tar.gz 이다.

        - http://ftp.kaist.ac.kr/pub/Apache/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.tar.gz


  2-2. 다운로드 받은 파일을 리눅스의 알맞은 폴더에 업로드한다.


  2-3. 압축 파일을 /usr/local 폴더에 복사한다.


  2-4. 압축을 푼다.
        $ tar xvzf apache-tomcat-5.5.20.tar.gz

   
  2-5. tomcat 으로 링크를 걸어 놓는다.

        - /usr/local/apache-tomcat-5.5.20 폴더가 생긴다.

        # ln -s apache-tomcat-5.5.20 tomcat

      

  2-6. 환경변수에 등록

        - 톰캣을 실행하려면 다음과 같이 두 개의 환경 변수를 먼저 지정해야 합니다.

 

        # export JAVA_HOME=/usr/local/j2sdk

        # export CATALINA_HOME=/usr/local/tomcat

 

        - /etc/profile 에도 다음과 같이 등록한다.

 

       JAVA_HOME=/usr/local/j2sdk
       CATALINA_HOME=/usr/local/tomcat

 

       export JAVA_HOME CATALINA_HOME

 

 

TOMCAT 실행

 

  3-1. 톰켓 실행 

        # /usr/local/apache-tomcat-5.5.20/bin/catalina.sh start

 

  3-2. 사용하기 편리하게 링크를 걸어 놓는다.

        # ln -s /usr/local/apache-tomcat-5.5.20/bin/catalina.sh /etc/init.d/tomcat

 

  3-3. 정상동작하는지 확인한다.

        - http://test.com:8080

 

 

참고)

The file $CATALINA_HOME/bin/jsvc/native/tomcat.sh can be used as a template for starting Tomcat automatically at boot time from /etc/init.d. The file is currently setup for running Tomcat 4.1.x, so it is necessary to edit it and change the classname from BootstrapService to Bootstrap.

 

/usr/local/apache-tomcat-5.5.20/bin 에서 jsvc.tar.gz 파일을 압출해제 하고 ./jsvc-src/native/tomcat5.sh 를 사용한다.

 

Note that the Commons-Daemon JAR file must be on your runtime classpath to run Tomcat in this manner. The Commons-Daemon JAR file is in the Class-Path entry of the bootstrap.jar manifest, but if you get a ClassNotFoundException or a NoClassDefFoundError for a Commons-Daemon class, add the Commons-Daemon JAR to the -cp argument when launching jsvc.

 

 

mod jk 1.2 생성 (소스 버전)

 

  4-1. JK 다운로드

        - http://tomcat.apache.org/download-connectors.cgi 사이트에서 JK 1.2 소스 버전을 다운로드 받는다.

        - http://apache.edgescape.com/tomcat/tomcat-connectors/jk/source/jk-1.2.20/tomcat-connectors-1.2.20-src.tar.gz

        - 아파치는 더이상 mod jk2를 공식적으로 지원하지 않는다.
        - 아래와 같은 순서로 설치한다.

 

        $ tar xvzf tomcat-connectors-1.2.19-src.tar.gz
        $ cd tomcat-connectors-1.2.19-src
        $ cd native
        $ ./configure --with-apxs=/usr/local/apache/bin/apxs
        $ make 2> make_error.txt | tee make_stdout.txt

        $ make install

        or 
       $ cp ./apache-2.0/mod_jk.so /usr/local/apache2.2/modules

 

        - RPM으로 아파치를 생성했으면, apxs 파일이 없다.

        - 이럴 경우 httpd-devel 패키지를 설치하면 /usr/sbin/apxs 가 생성된다.

 

        # yum install httpd-devel

 

       ./configure --with-apxs=/usr/sbin/apxs

 

        참고) 컴파일시 다음과 같이 명령을 내리면 컴파일중 문제 발생시 확인이 용이하다.

        $ make 2> make_error.txt | tee make_stdout.txt

        

 

Apache 웹 서버와 Tomcat 5.x 연동

 

JK 1.2를 사용하여 Tomcat 5.x 버전과 연동할 수 있다.

  5-1. worker.properties 파일작성

 

##################### /etc/httpd/conf/worker.properties #####################

# 사용할 worker 목록을 지정한다. 아래는 local worker만 지정하였으며, 여러 개를 지정해야 할 경우 콤마로 구분
worker.list=worker1

 

# local worker에 대한 설정: 톰캣 5.x는 ajp13을 기본적으로 제공한다.
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009

 

 

  5-2. tomcat.conf 파일을 작성

        - httpd.conf 파일이 로드되면서 함께 로드될 수 있도록 한다.

 

##################### /etc/httpd/conf/httpd.conf #####################

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf 

 

# 기본 으로 추가 되어 있다 두번 사용 하면 에러 나삼 추가 할피요 없음

참고)ServerRoot "/etc/httpd" <-- 아파치가 설치된 기본 위치

       ServerName localhost <-- 호스트 정보

       DocumentRoot "/web/webkores/webapp" <-- 변경

       --> DocumentRoot "/var/www/html" <--기본

       <Directory "/web/webkores/webapp">

        ~~~~

       </Directory>

      --> 기본

       <Directory "/var/www/html">

        ~~~~

       </Directory>

   이미지를 위해 추가 한다.<-추가 않해도 되는지 확인 해봐야되는딩 ㅋ

  Alias /resources/ "/web/webkores/webapp/resources/"

   <Directory "/web/webkores/webapp/resources">

     Options Indeses MultiViews 

     AllowOverride None

     Order allow,deny

     Allow from all

</Directory>

 

##################### /etc/httpd/conf.d/tomcat.conf  #####################

# tomcat 연동 모듈인 mod_jk를 로딩
LoadModule    jk_module  modules/mod_jk.so


# worker 정보가 설정된 파일의 경로 지정
JkWorkersFile   /etc/httpd/conf/worker.properties

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

 

# 어떤 요청을 톰캣으로 보낼 지 지정한다.
JkMount         /*.jsp worker1
JkMount         /servlet/* worker1
JkMount         /jsp-examples/* worker1
JkMount         /servlets-examples* worker1

 

  5-3. 연동테스트

        - http://test.com/index.jsp , http://test.com:8080/index.jsp 의 결과가 같은지 확인한다.

        - http://test.com/jsp-examples/ , http://test.com/servlets-examples/ 

          디렉터리가 정상적으로 보이고 내부의 JSP 파일 또는 서블릿 들이 정상적으로 실행되는지 확인한다.

 

 

  5-4. 데몬실행순서

         - tomcat 이 실행된 이후에 httpd 가 실행이 되어야 한다.

         -/톰켓 홈/bin/catalina.sh 하면 시작 된다 일케 하면 톰켓이 올라 가는것을 볼수 있다

         -/톰켓 홈/bin/startup.sh 하면 기본만 뜨삼

         - /etc/rc.d/init.d/httpd start <== 해서 아파치 실행

         - rc.local 에 tomcat 이 서버실행시 올라올 수 있도록 등록시켜 놓는다.

 

 

이와 관련된 보다 자세한 내용은 http://tomcat.apache.org/connectors-doc/howto/workers.html을 참고하기 바란다.

 

 

==>연동후 한글 깨지면

 톰켓의 server.xml 파일의

  connector port="8009"  에 URIEncoding="euc-kr" 을 추가 해준다.

 

 

 

 

참고 URL

 

JDK 설치 : http://cafe.naver.com/okjsp.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=109

JK 설치 : http://javacan.madvirus.net/


List of Articles
번호 제목 글쓴이 날짜 조회 수
48 사용자 인증 ADMINPLAY 2009.11.26 14017
47 squid 로 웹서버 가속하기..---== 강추 ==--- ADMINPLAY 2009.11.26 18254
46 아파치 데몬이 안 뜰경우 ADMINPLAY 2009.11.26 14874
45 apache2 worker 방식 client 수치 설정법 ADMINPLAY 2009.11.26 16069
44 rewrite 모듈을 이욜한 서브도메인으로 홈페이지 운영하기 ADMINPLAY 2009.11.26 14217
43 apache log에 그림이미지 파일 로그 안남기기 ADMINPLAY 2009.11.26 14666
42 SSL 인증서 발급 후 SSL mode 시작시 두 개의 패스워드 입... ADMINPLAY 2009.10.15 14176
41 브라우저 접속 제한하기 ADMINPLAY 2009.09.30 14691
40 아파치 컴파일 에러(apr-util) configure: error: cannet ... ADMINPLAY 2009.08.08 19574
39 APM 기본설치후 아파치 실행에러 httpd: Could not determ... ADMINPLAY 2009.08.08 21875
38 Apache Make시 /usr/lib/libexpat.so: could not read sym... ADMINPLAY 2009.08.07 17943
37 make[2]: *** [htpasswd] 오류 1 , make[1]: *** [all-rec... ADMINPLAY 2009.08.07 27099
36 Unclean shutdown of previous Apache run? ADMINPLAY 2009.08.05 21795
35 apache 에서 euc-kr홈페이지를 포팅할때 화면이안나올경우 ADMINPLAY 2009.07.18 14217
34 매일 자정에 트래픽 초기화 하기 ADMINPLAY 2009.07.18 15668
33 Apache 웹서버 MaxClient 최대값 조정을 위한 C & CPP 플... ADMINPLAY 2009.06.21 13815
32 Tomcat 4 과 Apache 2 연동 ADMINPLAY 2009.06.06 14616
31 [자료] 웹사이트 성능개선 위한 커널 튜닝 사례 ADMINPLAY 2009.05.10 13767
» [LINUX] Apache 2.2 + mod jk 1.2 + Tomcat 5.x 연동 ADMINPLAY 2009.05.07 21037
29 Apache의 Indexes된 페이지에서 한글표시 file ADMINPLAY 2009.05.07 16290
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234