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
번호 제목 글쓴이 날짜 조회 수
88 CentOS 5.X 에 MRTG설치 할때 한글 문제 ADMINPLAY 2014.06.06 6872
87 [Apache] 2.4 버전에서 403 에러시 [authz_core:error AH0... ADMINPLAY 2015.01.09 7275
86 SetEnvIf 지시어 설명 (mod_setenvif) ADMINPLAY 2014.01.18 7383
85 tomcat 에서 OutOfMemory에러가 발생할때 ADMINPLAY 2013.09.09 8765
84 APM설치 후 80포트가 연결이 안되요....ㅜㅜ 1 kimbongsoo 2013.02.14 9801
83 apache 설치시 에러 발생 collect2: ld returned 1 exit s... ADMINPLAY 2013.03.12 9809
82 WAS 란? WAS 뭐에요? file ADMINPLAY 2014.01.19 10961
81 우분투9.10 - Tomcat6 와 Apache2연동 ADMINPLAY 2012.10.31 11400
80 Apache expires 설정으로 브라우저 캐시 l2zeo 2013.03.18 11891
79 웹페이지 가속 기술인 모드 페이지스피드(mod_pagespeed)... l2zeo 2013.01.27 12143
78 Apache 1.3.12 httpd.conf 파일 한글설명 ADMINPLAY 2009.03.04 13361
77 apache log 정리 ADMINPLAY 2008.12.14 13527
76 [자료] 웹사이트 성능개선 위한 커널 튜닝 사례 ADMINPLAY 2009.05.10 13767
75 Apache 웹서버 MaxClient 최대값 조정을 위한 C & CPP 플... ADMINPLAY 2009.06.21 13815
74 사용자 인증 ADMINPLAY 2009.11.26 14017
73 CGI 오류: Premature end of script headers (Internal Se... 1 ADMINPLAY 2008.12.14 14127
72 SSL 인증서 발급 후 SSL mode 시작시 두 개의 패스워드 입... ADMINPLAY 2009.10.15 14176
71 httpd.conf 파일에 대한 설명 / 번역 ADMINPLAY 2008.10.08 14196
70 apache 에서 euc-kr홈페이지를 포팅할때 화면이안나올경우 ADMINPLAY 2009.07.18 14217
69 rewrite 모듈을 이욜한 서브도메인으로 홈페이지 운영하기 ADMINPLAY 2009.11.26 14217
Board Pagination Prev 1 2 3 4 5 Next
/ 5

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234